mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-01 10:22:25 +00:00
fix(storage): prevent r2 upload failure by removing restricted header
Removed the `cf-create-bucket-if-missing` header from the multipart upload request in `js/storage/r2-s3.js`. This header triggers a 403 Forbidden error (and subsequent "Failed to fetch" due to CORS behavior) when using R2 API tokens with limited "Object Read & Write" permissions, as it requires bucket creation privileges. Bucket existence is now handled separately.
This commit is contained in:
1 parent
c3179672b1
commit
2758081a2f
1 file changed
-10
@@ -258,16 +258,6 @@ export async function multipartUpload({
|
||||
CacheControl: computeCacheControl(key),
|
||||
});
|
||||
|
||||
createCommand.middlewareStack.add(
|
||||
(next) => async (args) => {
|
||||
if (args?.request?.headers) {
|
||||
args.request.headers["cf-create-bucket-if-missing"] = "true";
|
||||
}
|
||||
return next(args);
|
||||
},
|
||||
{ step: "build" }
|
||||
);
|
||||
|
||||
const { UploadId } = await s3.send(createCommand);
|
||||
|
||||
if (!UploadId) {
|
||||
|
||||
Reference in new issue
Block a user