Skip to content

Commit 84cb980

Browse files
authored
fix(storage): clean up cached files upon completion (#3967)
1 parent 5b603ff commit 84cb980

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Internal/StorageMultipartUploadClient.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ class DefaultStorageMultipartUploadClient: StorageMultipartUploadClient {
146146
Task {
147147
do {
148148
let partialFileURL = try result.get()
149+
defer {
150+
// Clean up the temporary file after we're done with it
151+
self.fileSystem.removeFileIfExists(fileURL: partialFileURL)
152+
}
149153

150154
let operation = AWSS3SigningOperation.uploadPart(partNumber: partNumber, uploadId: uploadId)
151155
let preSignedURL = try await serviceProxy.preSignedURLBuilder.getPreSignedURL(

0 commit comments

Comments
 (0)