Prune
This commit is contained in:
@@ -167,81 +167,6 @@ export class PhotosUploadHTTPClient {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
async putFilePart(
|
||||
partUploadURL: string,
|
||||
filePart: Uint8Array,
|
||||
progressTracker: unknown,
|
||||
) {
|
||||
try {
|
||||
const response = await retryAsyncOperation(async () => {
|
||||
const resp = await HTTPService.put(
|
||||
partUploadURL,
|
||||
filePart,
|
||||
// @ts-ignore
|
||||
null,
|
||||
null,
|
||||
progressTracker,
|
||||
);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (!resp?.headers?.etag) {
|
||||
const err = Error(CustomError.ETAG_MISSING);
|
||||
log.error("putFile in parts failed", err);
|
||||
throw err;
|
||||
}
|
||||
return resp;
|
||||
}, handleUploadError);
|
||||
return response.headers.etag as string;
|
||||
} catch (e) {
|
||||
if (
|
||||
!(
|
||||
e instanceof Error &&
|
||||
e.message == CustomError.UPLOAD_CANCELLED
|
||||
)
|
||||
) {
|
||||
log.error("put filePart failed", e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
async putFilePartV2(
|
||||
partUploadURL: string,
|
||||
filePart: Uint8Array,
|
||||
progressTracker: unknown,
|
||||
) {
|
||||
try {
|
||||
const origin = await uploaderOrigin();
|
||||
const response = await retryAsyncOperation(async () => {
|
||||
const resp = await HTTPService.put(
|
||||
`${origin}/multipart-upload`,
|
||||
filePart,
|
||||
// @ts-ignore
|
||||
null,
|
||||
{ "UPLOAD-URL": partUploadURL },
|
||||
progressTracker,
|
||||
);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (!resp?.data?.etag) {
|
||||
const err = Error(CustomError.ETAG_MISSING);
|
||||
log.error("putFile in parts failed", err);
|
||||
throw err;
|
||||
}
|
||||
return resp;
|
||||
});
|
||||
return response.data.etag as string;
|
||||
} catch (e) {
|
||||
if (
|
||||
!(
|
||||
e instanceof Error &&
|
||||
e.message == CustomError.UPLOAD_CANCELLED
|
||||
)
|
||||
) {
|
||||
log.error("put filePart failed", e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user