diff --git a/CHANGELOG.md b/CHANGELOG.md index 471bc334..5d8fc87e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,12 @@ +# 3.4.1 + +## Bugfix +- Corrected a mistake in delete file logic + # 3.4.0 ## Bugfix -- Fixed an issue that prevented TUSKit from uploading large files (2GB+) [#193](https://github.com/tus/TUSKit/issues/193) +- Fixed an issue that prevented TUSKit from uploading large files (2GB+) [#193](https://github.com/tus/TUSKit/issues/193)** # 3.3.0 diff --git a/Sources/TUSKit/Files.swift b/Sources/TUSKit/Files.swift index 67bb8970..4a16b649 100644 --- a/Sources/TUSKit/Files.swift +++ b/Sources/TUSKit/Files.swift @@ -169,7 +169,10 @@ final class Files { try queue.sync { try FileManager.default.removeItem(at: metaDataPath) - try FileManager.default.removeItem(at: metaDataCachePath) + + if FileManager.default.fileExists(atPath: metaDataCachePath.path) { + try FileManager.default.removeItem(at: metaDataCachePath) + } if FileManager.default.fileExists(atPath: uploadDataCachePath.path) { try FileManager.default.removeItem(at: uploadDataCachePath) diff --git a/TUSKit.podspec b/TUSKit.podspec index abb1d7a0..2cc33290 100644 --- a/TUSKit.podspec +++ b/TUSKit.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| s.name = 'TUSKit' - s.version = '3.4' + s.version = '3.4.1' s.summary = 'TUSKit client in Swift' s.swift_version = '5.0' diff --git a/Tests/TUSKitTests/FilesTests.swift b/Tests/TUSKitTests/FilesTests.swift index 00ae22f1..63dadcee 100644 --- a/Tests/TUSKitTests/FilesTests.swift +++ b/Tests/TUSKitTests/FilesTests.swift @@ -168,7 +168,26 @@ final class FilesTests: XCTestCase { // Clean up metadata. Doing it here because normally cleaning up metadata also cleans up a file. But we don't have a file to clean up. try FileManager.default.removeItem(at: targetLocation) } - + + func testMissingCachePathDoesNotThrow() throws { + let data = "TestData".data(using: .utf8)! + let id = UUID() + let path = try files.store(data: data, id: id, preferredFileExtension: ".txt") + let metaData = UploadMetadata( + id: id, + filePath: path, + uploadURL: URL(string: "io.tus")!, + size: data.count, + customHeaders: [:], + mimeType: nil + ) + XCTAssertNoThrow(try files.encodeAndStore(metaData: metaData)) + + print("PATH", path.path) + + XCTAssertNoThrow(try files.removeFileAndMetadata(metaData)) + } + func testMakeSureFileIdIsSameAsStoredName() throws { // A file is stored under a UUID, this must be the same as the metadata's id let id = UUID()