( bucketPath: string, uploadId: string, msg?: string, )
| 74 | }; |
| 75 | |
| 76 | const abortMultiPartUpload = async ( |
| 77 | bucketPath: string, |
| 78 | uploadId: string, |
| 79 | msg?: string, |
| 80 | ) => { |
| 81 | const resp = await fetch( |
| 82 | `https://upload.fontsource.org/multipart/${bucketPath}?action=mpu-abort`, |
| 83 | { |
| 84 | method: 'DELETE', |
| 85 | headers: { |
| 86 | Authorization: `Bearer ${ |
| 87 | // biome-ignore lint/style/noNonNullAssertion: <explanation> |
| 88 | process.env.UPLOAD_KEY! |
| 89 | }`, |
| 90 | }, |
| 91 | body: JSON.stringify({ |
| 92 | uploadId, |
| 93 | }), |
| 94 | }, |
| 95 | ); |
| 96 | |
| 97 | if (!resp.ok) { |
| 98 | const error = await resp.text(); |
| 99 | const errorMsg = `Unable to abort multipart upload. ${error}`; |
| 100 | handleBucketError(resp, msg ? `${msg} ${errorMsg}` : errorMsg); |
| 101 | } |
| 102 | }; |
| 103 | |
| 104 | const initiateMultipartUpload = async (bucketPath: string): Promise<string> => { |
| 105 | const resp = await fetch( |
no test coverage detected