Skip to content

Commit

Permalink
fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
drochetti committed Nov 26, 2024
1 parent 5b2860b commit 68724f2
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions libs/client/src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async function partUploadRetries(
uploadUrl: string,
chunk: Blob,
config: RequiredConfig,
tries: number = 3,
tries = 3,
): Promise<MultipartObject> {
if (tries === 0) {
throw new Error("Part upload failed, retries exhausted");
Expand Down Expand Up @@ -142,21 +142,17 @@ async function multipartUpload(

const responses: MultipartObject[] = [];

try {
for (let i = 0; i < chunks; i++) {
const start = i * chunkSize;
const end = Math.min(start + chunkSize, file.size);
for (let i = 0; i < chunks; i++) {
const start = i * chunkSize;
const end = Math.min(start + chunkSize, file.size);

const chunk = file.slice(start, end);
const chunk = file.slice(start, end);

const partNumber = i + 1;
// {uploadUrl}/{part_number}?uploadUrlParams=...
const partUploadUrl = `${parsedUrl.origin}${parsedUrl.pathname}/${partNumber}${parsedUrl.search}`;
const partNumber = i + 1;
// {uploadUrl}/{part_number}?uploadUrlParams=...
const partUploadUrl = `${parsedUrl.origin}${parsedUrl.pathname}/${partNumber}${parsedUrl.search}`;

responses.push(await partUploadRetries(partUploadUrl, chunk, config));
}
} catch (error) {
throw error;
responses.push(await partUploadRetries(partUploadUrl, chunk, config));
}

// Complete the upload
Expand Down

0 comments on commit 68724f2

Please sign in to comment.