From 00174745d80b87f116296d2133e6bc1f24b26888 Mon Sep 17 00:00:00 2001 From: Michael Redig Date: Mon, 23 Sep 2024 02:23:04 -0500 Subject: [PATCH 1/4] fix uploadmodel search path intention --- upload/Sources/App/Models/UploadModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upload/Sources/App/Models/UploadModel.swift b/upload/Sources/App/Models/UploadModel.swift index 3e8f261b..2c2453f5 100644 --- a/upload/Sources/App/Models/UploadModel.swift +++ b/upload/Sources/App/Models/UploadModel.swift @@ -21,7 +21,7 @@ extension UploadModel { /// - Returns: the target directory for uploads func destinationURL(searchPath: FileManager.SearchPathDirectory = .documentDirectory, allowsOverwrite: Bool = false) throws -> URL { let fileURL = try FileManager.default.url( - for: .documentDirectory, + for: searchPath, in: .userDomainMask, appropriateFor: nil, create: true From 13a089747c9740aa8c927f4b04abb6485f9e6281 Mon Sep 17 00:00:00 2001 From: Michael Redig Date: Mon, 23 Sep 2024 02:23:24 -0500 Subject: [PATCH 2/4] avoid using string path in checking for file existing --- upload/Sources/App/Models/UploadModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upload/Sources/App/Models/UploadModel.swift b/upload/Sources/App/Models/UploadModel.swift index 2c2453f5..efd1d88d 100644 --- a/upload/Sources/App/Models/UploadModel.swift +++ b/upload/Sources/App/Models/UploadModel.swift @@ -28,7 +28,7 @@ extension UploadModel { ).appendingPathComponent(self.filename) guard allowsOverwrite == false else { return fileURL } - guard FileManager.default.fileExists(atPath: fileURL.path) == false else { + guard (try? fileURL.checkResourceIsReachable()) == false else { throw HTTPError(.conflict) } return fileURL From 283b08a302daa9d07c712f7715e8e975df9eea4b Mon Sep 17 00:00:00 2001 From: Michael Redig Date: Mon, 23 Sep 2024 02:26:05 -0500 Subject: [PATCH 3/4] revert indentation --- upload/Sources/App/Models/UploadModel.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/upload/Sources/App/Models/UploadModel.swift b/upload/Sources/App/Models/UploadModel.swift index efd1d88d..4852f228 100644 --- a/upload/Sources/App/Models/UploadModel.swift +++ b/upload/Sources/App/Models/UploadModel.swift @@ -21,14 +21,14 @@ extension UploadModel { /// - Returns: the target directory for uploads func destinationURL(searchPath: FileManager.SearchPathDirectory = .documentDirectory, allowsOverwrite: Bool = false) throws -> URL { let fileURL = try FileManager.default.url( - for: searchPath, + for: searchPath, in: .userDomainMask, appropriateFor: nil, create: true ).appendingPathComponent(self.filename) guard allowsOverwrite == false else { return fileURL } - guard (try? fileURL.checkResourceIsReachable()) == false else { + guard (try? fileURL.checkResourceIsReachable()) == false else { throw HTTPError(.conflict) } return fileURL From 24a33691728bcc6849a4180396cbbdc9e9e64583 Mon Sep 17 00:00:00 2001 From: Michael Redig Date: Mon, 23 Sep 2024 21:05:31 -0500 Subject: [PATCH 4/4] bump requirements --- todos-auth-fluent/Package.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/todos-auth-fluent/Package.swift b/todos-auth-fluent/Package.swift index dae11066..ca814dab 100644 --- a/todos-auth-fluent/Package.swift +++ b/todos-auth-fluent/Package.swift @@ -8,11 +8,11 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0"), - .package(url: "https://github.com/hummingbird-project/hummingbird-auth.git", from: "2.0.0-rc.2"), - .package(url: "https://github.com/hummingbird-project/hummingbird-fluent.git", from: "2.0.0-beta.2"), - .package(url: "https://github.com/hummingbird-project/swift-mustache.git", from: "2.0.0-beta.1"), + .package(url: "https://github.com/hummingbird-project/hummingbird-auth.git", from: "2.0.0-rc.4"), + .package(url: "https://github.com/hummingbird-project/hummingbird-fluent.git", from: "2.0.0-beta.4"), + .package(url: "https://github.com/hummingbird-project/swift-mustache.git", from: "2.0.0-rc.1"), .package(url: "https://github.com/vapor/fluent-kit.git", from: "1.48.5"), - .package(url: "https://github.com/vapor/fluent-sqlite-driver.git", from: "4.0.0"), + .package(url: "https://github.com/vapor/fluent-sqlite-driver.git", from: "4.7.0"), .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.4.0"), ], targets: [