Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lohanidamodar committed Nov 28, 2024
1 parent 93ce8a4 commit 9877787
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Storage/Device/S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,15 @@ public function uploadData(string $data, string $path, string $contentType, int
$metadata['uploadId'] = $uploadId;
}

$etag = $this->uploadPart($data, $path, $contentType, $chunk, $uploadId);
$metadata['parts'] ??= [];
$metadata['parts'][$chunk] = $etag;
$metadata['chunksUploaded'] ??= [];
$metadata['chunks'] ??= 0;

$etag = $this->uploadPart($data, $path, $contentType, $chunk, $uploadId);
// skip incrementing if the chunk was re-uploaded
if (! array_key_exists($chunk, $metadata['chunksUploaded'])) {
$metadata['chunksUploaded'][$chunk] = true;
if (! array_key_exists($chunk, $metadata['parts'])) {
$metadata['chunks']++;
}
$metadata['parts'][$chunk] = $etag;
if ($metadata['chunks'] == $chunks) {
$this->completeMultipartUpload($path, $uploadId, $metadata['parts']);
}
Expand Down

0 comments on commit 9877787

Please sign in to comment.