Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance saveToTempFile method to accept file extension parameter #2

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/RqesKit/RQESService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public class RQESService: RQESServiceProtocol, @unchecked Sendable {
return try await rqes.calculateHash(request: request, accessToken: accessToken)
}

static func saveToTempFile(data: Data) throws -> URL {
static func saveToTempFile(data: Data, ext: String = ".pdf") throws -> URL {
let tempDir = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
let tempFile = tempDir.appendingPathComponent(UUID().uuidString)
let tempFile = tempDir.appendingPathComponent("\(UUID().uuidString)\(ext)")
try data.write(to: tempFile)
return tempFile
}
Expand Down