diff --git a/CHANGELOG.md b/CHANGELOG.md index 95a60b86..302dde28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,17 @@ -# 3.3 + +# 3.4 + +## Bugfix +- Fixed an issue that prevented TUSKit from uploading large files (2GB+) [#193](https://github.com/tus/TUSKit/issues/193) + +# 3.3.0 ## Enhancements - Updated documentation around background uploads ## Bugfix -- Fixed an issu with macOS not having a correct path when resuming uploads. Thanks, [@MartinLau7](https://github.com/MartinLau7) +- Fixed an issue with macOS not having a correct path when resuming uploads. Thanks, [@MartinLau7](https://github.com/MartinLau7) - Fixed a metadta issue on iOS. Thanks, [@MartinLau7](https://github.com/MartinLau7) - Fixed some issues with metadata not alwasy being cleaned up properly for all platforms. Thanks, [@MartinLau7](https://github.com/MartinLau7) diff --git a/Sources/TUSKit/Tasks/UploadDataTask.swift b/Sources/TUSKit/Tasks/UploadDataTask.swift index 771729f2..7d24ffeb 100644 --- a/Sources/TUSKit/Tasks/UploadDataTask.swift +++ b/Sources/TUSKit/Tasks/UploadDataTask.swift @@ -76,10 +76,12 @@ final class UploadDataTask: NSObject, IdentifiableTask { return } - let dataToUpload: Data + let dataSize: Int let file: URL do { - dataToUpload = try loadData() + let attr = try FileManager.default.attributesOfItem(atPath: metaData.filePath.path) + dataSize = attr[FileAttributeKey.size] as! Int + file = try prepareUploadFile() } catch let error { let tusError = TUSClientError.couldNotLoadData(underlyingError: error) @@ -104,7 +106,7 @@ final class UploadDataTask: NSObject, IdentifiableTask { sessionTask = task if #available(iOS 11.0, macOS 10.13, *) { - observeTask(task: task, size: dataToUpload.count) + observeTask(task: task, size: dataSize) } } @@ -190,8 +192,8 @@ final class UploadDataTask: NSObject, IdentifiableTask { Note that compiler and api says that readToEnd is available on macOS 10.15.4 and higher, but yet github actions of 10.15.7 fails to find the member. return try fileHandle.readToEnd() */ - } else { // No range, older versions - data = fileHandle.readDataToEndOfFile() + } else { // No range, we're uploading the file in full so no need to read / recopy + return metaData.filePath } return try files.store(data: data, id: metaData.id, preferredFileExtension: "uploadData") diff --git a/TUSKitExample/TUSKitExample.xcodeproj/project.pbxproj b/TUSKitExample/TUSKitExample.xcodeproj/project.pbxproj index d2766f9f..aa185604 100644 --- a/TUSKitExample/TUSKitExample.xcodeproj/project.pbxproj +++ b/TUSKitExample/TUSKitExample.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -545,7 +545,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_ASSET_PATHS = "\"TUSKitExample/Preview Content\""; - DEVELOPMENT_TEAM = G43DLT797F; + DEVELOPMENT_TEAM = 4JMM8JMG3H; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = TUSKitExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.1; @@ -567,7 +567,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_ASSET_PATHS = "\"TUSKitExample/Preview Content\""; - DEVELOPMENT_TEAM = G43DLT797F; + DEVELOPMENT_TEAM = 4JMM8JMG3H; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = TUSKitExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.1;