Fix R2 bucket path URL
This commit is contained in:
parent
07381bdf90
commit
cbc058acbe
1 changed files with 2 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ function getR2() {
|
||||||
throw new Error(`Missing R2 config`);
|
throw new Error(`Missing R2 config`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// R2 uses path-style: https://<accountId>.r2.cloudflarestorage.com/<bucket>
|
||||||
return {
|
return {
|
||||||
client: new S3Client({
|
client: new S3Client({
|
||||||
region: "auto",
|
region: "auto",
|
||||||
|
|
@ -19,7 +20,7 @@ function getR2() {
|
||||||
credentials: { accessKeyId, secretAccessKey: secretKey },
|
credentials: { accessKeyId, secretAccessKey: secretKey },
|
||||||
}),
|
}),
|
||||||
bucket,
|
bucket,
|
||||||
baseUrl: `https://${accountId}.r2.cloudflarestorage.com`,
|
baseUrl: `https://${accountId}.r2.cloudflarestorage.com/${bucket}`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue