Skip to content

Commit 2d84440

Browse files
committed
Merge branch 'release/1.11.3'
2 parents 92e6e3d + f5075bb commit 2d84440

File tree

5 files changed

+14
-23
lines changed

5 files changed

+14
-23
lines changed

CryptomatorCloudAccess.xcodeproj/project.pbxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -1890,10 +1890,10 @@
18901890
};
18911891
B3C72B752BFC798A006F8218 /* XCRemoteSwiftPackageReference "box-swift-sdk-gen" */ = {
18921892
isa = XCRemoteSwiftPackageReference;
1893-
repositoryURL = "https://github.com/box/box-swift-sdk-gen.git";
1893+
repositoryURL = "https://github.com/tobihagemann/box-swift-sdk-gen.git";
18941894
requirement = {
1895-
kind = upToNextMinorVersion;
1896-
minimumVersion = 0.5.0;
1895+
kind = exactVersion;
1896+
version = "0.5.0-cryptomator";
18971897
};
18981898
};
18991899
/* End XCRemoteSwiftPackageReference section */

CryptomatorCloudAccess.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"originHash" : "9cadc7a70613b038fe8d97d191b9a6f48d09309fa0636f36dfa1ef6376591ebc",
2+
"originHash" : "1e544db849a8e8bec5142a55d1c8c095e3af91fce1264266393ab47c4271d671",
33
"pins" : [
44
{
55
"identity" : "appauth-ios",
@@ -31,10 +31,10 @@
3131
{
3232
"identity" : "box-swift-sdk-gen",
3333
"kind" : "remoteSourceControl",
34-
"location" : "https://github.com/box/box-swift-sdk-gen.git",
34+
"location" : "https://github.com/tobihagemann/box-swift-sdk-gen.git",
3535
"state" : {
36-
"revision" : "a6b5793ab4053f9b55b840245ad07c9e3fdae344",
37-
"version" : "0.5.0"
36+
"revision" : "b2bb9db3b4fc5e86807f3c5043bedcab9fdf48f7",
37+
"version" : "0.5.0-cryptomator"
3838
}
3939
},
4040
{

Package.resolved

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
{
3131
"identity" : "box-swift-sdk-gen",
3232
"kind" : "remoteSourceControl",
33-
"location" : "https://github.com/box/box-swift-sdk-gen.git",
33+
"location" : "https://github.com/tobihagemann/box-swift-sdk-gen.git",
3434
"state" : {
35-
"revision" : "a6b5793ab4053f9b55b840245ad07c9e3fdae344",
36-
"version" : "0.5.0"
35+
"revision" : "b2bb9db3b4fc5e86807f3c5043bedcab9fdf48f7",
36+
"version" : "0.5.0-cryptomator"
3737
}
3838
},
3939
{

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ let package = Package(
3030
dependencies: [
3131
.package(url: "https://github.com/AzureAD/microsoft-authentication-library-for-objc.git", .upToNextMinor(from: "1.3.0")),
3232
.package(url: "https://github.com/aws-amplify/aws-sdk-ios-spm.git", .upToNextMinor(from: "2.34.0")),
33-
.package(url: "https://github.com/box/box-swift-sdk-gen.git", .upToNextMinor(from: "0.5.0")),
3433
.package(url: "https://github.com/cryptomator/cryptolib-swift.git", .upToNextMinor(from: "1.1.0")),
3534
.package(url: "https://github.com/CocoaLumberjack/CocoaLumberjack.git", .upToNextMinor(from: "3.8.0")),
3635
.package(url: "https://github.com/google/google-api-objectivec-client-for-rest.git", .upToNextMinor(from: "3.4.0")),
@@ -43,6 +42,7 @@ let package = Package(
4342
.package(url: "https://github.com/phil1995/dropbox-sdk-obj-c-spm.git", .upToNextMinor(from: "7.2.0")),
4443
.package(url: "https://github.com/phil1995/msgraph-sdk-objc-spm.git", .upToNextMinor(from: "1.0.0")),
4544
.package(url: "https://github.com/phil1995/msgraph-sdk-objc-models-spm.git", .upToNextMinor(from: "1.3.0")),
45+
.package(url: "https://github.com/tobihagemann/box-swift-sdk-gen.git", exact: "0.5.0-cryptomator"),
4646
.package(url: "https://github.com/tobihagemann/JOSESwift.git", exact: "2.4.1-cryptomator")
4747
],
4848
targets: [

Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift

+3-12
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,12 @@ public class BoxCloudProvider: CloudProvider {
245245
let pendingPromise = Promise<CloudItemMetadata>.pending()
246246
_Concurrency.Task {
247247
do {
248-
guard let fileStream = InputStream(url: localURL) else {
249-
throw CloudProviderError.itemNotFound
250-
}
251248
let requestBody = UploadFileRequestBody(
252249
attributes: UploadFileRequestBodyAttributesField(
253250
name: cloudPath.lastPathComponent,
254251
parent: UploadFileRequestBodyAttributesParentField(id: parentItem.identifier)
255252
),
256-
file: fileStream
253+
fileURL: localURL
257254
)
258255
let files = try await client.uploads.uploadFile(requestBody: requestBody)
259256
guard let file = files.entries?.first else {
@@ -274,12 +271,9 @@ public class BoxCloudProvider: CloudProvider {
274271
let pendingPromise = Promise<CloudItemMetadata>.pending()
275272
_Concurrency.Task {
276273
do {
277-
guard let fileStream = InputStream(url: localURL) else {
278-
throw CloudProviderError.itemNotFound
279-
}
280274
let requestBody = UploadFileVersionRequestBody(
281275
attributes: UploadFileVersionRequestBodyAttributesField(name: cloudPath.lastPathComponent),
282-
file: fileStream
276+
fileURL: localURL
283277
)
284278
let files = try await client.uploads.uploadFileVersion(fileId: existingItem.identifier, requestBody: requestBody)
285279
guard let file = files.entries?.first else {
@@ -329,14 +323,11 @@ public class BoxCloudProvider: CloudProvider {
329323
}
330324

331325
private func uploadLargeFile(for uploadSession: UploadSession, from localURL: URL, to cloudPath: CloudPath, fileSize: Int) async throws -> CloudItemMetadata {
332-
guard let fileStream = InputStream(url: localURL) else {
333-
throw CloudProviderError.itemNotFound
334-
}
335326
guard let uploadPartUrl = uploadSession.sessionEndpoints?.uploadPart, let commitUrl = uploadSession.sessionEndpoints?.commit, let partSize = uploadSession.partSize else {
336327
throw BoxSDKError(message: "Failed to retrieve upload session data")
337328
}
338329
let fileHash = Hash(algorithm: .sha1)
339-
let chunksIterator = Utils.iterateChunks(stream: fileStream, chunkSize: partSize, fileSize: Int64(fileSize))
330+
let chunksIterator = Utils.iterateChunks(fileURL: localURL, chunkSize: partSize, fileSize: Int64(fileSize))
340331
let results = try await Utils.reduceIterator(iterator: chunksIterator, reducer: client.chunkedUploads.reducer, initialValue: PartAccumulator(lastIndex: -1, parts: [], fileSize: Int64(fileSize), uploadPartUrl: uploadPartUrl, fileHash: fileHash))
341332
let sha1 = await fileHash.digestHash(encoding: "base64")
342333
let digest = "\("sha=")\(sha1)"

0 commit comments

Comments
 (0)