Skip to content

Commit

Permalink
Fixed #196
Browse files Browse the repository at this point in the history
  • Loading branch information
donnywals committed Oct 14, 2024
1 parent aed9392 commit 915bb14
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 4 additions & 1 deletion Sources/TUSKit/Files.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion TUSKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
21 changes: 20 additions & 1 deletion Tests/TUSKitTests/FilesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 915bb14

Please sign in to comment.