Skip to content

Commit

Permalink
Updated Box dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
tobihagemann committed Aug 22, 2024
1 parent fbca37a commit f7cf895
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"originHash" : "9cadc7a70613b038fe8d97d191b9a6f48d09309fa0636f36dfa1ef6376591ebc",
"pins" : [
{
"identity" : "appauth-ios",
Expand All @@ -14,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/aws-amplify/aws-sdk-ios-spm.git",
"state" : {
"revision" : "cfcf97f6994b6ffd9a3244dc638458f5822aba56",
"version" : "2.34.0"
"revision" : "8ff8bebfe24271f7b16c5abaeb78daf82bee3a80",
"version" : "2.34.2"
}
},
{
Expand All @@ -32,17 +33,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/box/box-swift-sdk-gen.git",
"state" : {
"revision" : "b3fd5bfb78f67639151a6a11ba52bad0587e4d34",
"version" : "0.3.0"
"revision" : "7b2e3963a4f9d7c608ba9176fa3c32d260599906",
"version" : "0.3.1"
}
},
{
"identity" : "cocoalumberjack",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CocoaLumberjack/CocoaLumberjack.git",
"state" : {
"revision" : "67ec5818a757aba4d7c534e21a905d878d128dbf",
"version" : "3.8.1"
"revision" : "4b8714a7fb84d42393314ce897127b3939885ec3",
"version" : "3.8.5"
}
},
{
Expand Down Expand Up @@ -113,8 +114,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/AzureAD/microsoft-authentication-library-for-objc.git",
"state" : {
"revision" : "f3f84a63de86f7f121544ec917e0365e624d6a97",
"version" : "1.3.0"
"revision" : "d2f81ded070ac6452b2a6acb5bc45eb566427fe7",
"version" : "1.3.3"
}
},
{
Expand Down Expand Up @@ -156,12 +157,12 @@
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"location" : "https://github.com/apple/swift-log",
"state" : {
"revision" : "532d8b529501fb73a2455b179e0bbb6d49b652ed",
"version" : "1.5.3"
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
"version" : "1.6.1"
}
}
],
"version" : 2
"version" : 3
}
16 changes: 8 additions & 8 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/aws-amplify/aws-sdk-ios-spm.git",
"state" : {
"revision" : "cfcf97f6994b6ffd9a3244dc638458f5822aba56",
"version" : "2.34.0"
"revision" : "8ff8bebfe24271f7b16c5abaeb78daf82bee3a80",
"version" : "2.34.2"
}
},
{
Expand All @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/box/box-swift-sdk-gen.git",
"state" : {
"revision" : "b3fd5bfb78f67639151a6a11ba52bad0587e4d34",
"version" : "0.3.0"
"revision" : "7b2e3963a4f9d7c608ba9176fa3c32d260599906",
"version" : "0.3.1"
}
},
{
Expand Down Expand Up @@ -113,8 +113,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/AzureAD/microsoft-authentication-library-for-objc.git",
"state" : {
"revision" : "f3f84a63de86f7f121544ec917e0365e624d6a97",
"version" : "1.3.0"
"revision" : "d2f81ded070ac6452b2a6acb5bc45eb566427fe7",
"version" : "1.3.3"
}
},
{
Expand Down Expand Up @@ -158,8 +158,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log",
"state" : {
"revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5",
"version" : "1.5.4"
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
"version" : "1.6.1"
}
}
],
Expand Down
8 changes: 4 additions & 4 deletions Sources/CryptomatorCloudAccess/Box/BoxCloudProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,15 @@ public class BoxCloudProvider: CloudProvider {
guard let fileStream = InputStream(url: localURL) else {
throw CloudProviderError.itemNotFound
}
guard let uploadSessionId = uploadSession.id, let partSize = uploadSession.partSize else {
guard let uploadPartUrl = uploadSession.sessionEndpoints?.uploadPart, let commitUrl = uploadSession.sessionEndpoints?.commit, let partSize = uploadSession.partSize else {
throw BoxSDKError(message: "Failed to retrieve upload session data")
}
let fileHash = Hash(algorithm: .sha1)
let chunksIterator = Utils.iterateChunks(stream: fileStream, chunkSize: partSize)
let results = try await Utils.reduceIterator(iterator: chunksIterator, reducer: client.chunkedUploads.reducer, initialValue: PartAccumulator(lastIndex: -1, parts: [], fileSize: Int64(fileSize), uploadSessionId: uploadSessionId, fileHash: fileHash))
let chunksIterator = Utils.iterateChunks(stream: fileStream, chunkSize: partSize, fileSize: Int64(fileSize))
let results = try await Utils.reduceIterator(iterator: chunksIterator, reducer: client.chunkedUploads.reducer, initialValue: PartAccumulator(lastIndex: -1, parts: [], fileSize: Int64(fileSize), uploadPartUrl: uploadPartUrl, fileHash: fileHash))
let sha1 = await fileHash.digestHash(encoding: "base64")
let digest = "\("sha=")\(sha1)"
let committedSession = try await client.chunkedUploads.createFileUploadSessionCommit(uploadSessionId: uploadSessionId, requestBody: CreateFileUploadSessionCommitRequestBody(parts: results.parts), headers: CreateFileUploadSessionCommitHeaders(digest: digest))
let committedSession = try await client.chunkedUploads.createFileUploadSessionCommitByUrl(url: commitUrl, requestBody: CreateFileUploadSessionCommitByUrlRequestBody(parts: results.parts), headers: CreateFileUploadSessionCommitByUrlHeaders(digest: digest))
guard let file = committedSession.entries?.first else {
throw CloudProviderError.itemNotFound
}
Expand Down

0 comments on commit f7cf895

Please sign in to comment.