Skip to content

Commit 915bb14

Browse files
committed
Fixed #196
1 parent aed9392 commit 915bb14

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
# 3.4.1
2+
3+
## Bugfix
4+
- Corrected a mistake in delete file logic
5+
16
# 3.4.0
27

38
## Bugfix
4-
- Fixed an issue that prevented TUSKit from uploading large files (2GB+) [#193](https://github.com/tus/TUSKit/issues/193)
9+
- Fixed an issue that prevented TUSKit from uploading large files (2GB+) [#193](https://github.com/tus/TUSKit/issues/193)**
510

611
# 3.3.0
712

Sources/TUSKit/Files.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,10 @@ final class Files {
169169

170170
try queue.sync {
171171
try FileManager.default.removeItem(at: metaDataPath)
172-
try FileManager.default.removeItem(at: metaDataCachePath)
172+
173+
if FileManager.default.fileExists(atPath: metaDataCachePath.path) {
174+
try FileManager.default.removeItem(at: metaDataCachePath)
175+
}
173176

174177
if FileManager.default.fileExists(atPath: uploadDataCachePath.path) {
175178
try FileManager.default.removeItem(at: uploadDataCachePath)

TUSKit.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
Pod::Spec.new do |s|
99
s.name = 'TUSKit'
10-
s.version = '3.4'
10+
s.version = '3.4.1'
1111
s.summary = 'TUSKit client in Swift'
1212
s.swift_version = '5.0'
1313

Tests/TUSKitTests/FilesTests.swift

+20-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,26 @@ final class FilesTests: XCTestCase {
168168
// 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.
169169
try FileManager.default.removeItem(at: targetLocation)
170170
}
171-
171+
172+
func testMissingCachePathDoesNotThrow() throws {
173+
let data = "TestData".data(using: .utf8)!
174+
let id = UUID()
175+
let path = try files.store(data: data, id: id, preferredFileExtension: ".txt")
176+
let metaData = UploadMetadata(
177+
id: id,
178+
filePath: path,
179+
uploadURL: URL(string: "io.tus")!,
180+
size: data.count,
181+
customHeaders: [:],
182+
mimeType: nil
183+
)
184+
XCTAssertNoThrow(try files.encodeAndStore(metaData: metaData))
185+
186+
print("PATH", path.path)
187+
188+
XCTAssertNoThrow(try files.removeFileAndMetadata(metaData))
189+
}
190+
172191
func testMakeSureFileIdIsSameAsStoredName() throws {
173192
// A file is stored under a UUID, this must be the same as the metadata's id
174193
let id = UUID()

0 commit comments

Comments
 (0)