Use R2 public development URL
This commit is contained in:
parent
864ecc2587
commit
4acd016b70
1 changed files with 3 additions and 6 deletions
|
|
@ -12,11 +12,8 @@ function getR2() {
|
|||
throw new Error(`Missing R2 config`);
|
||||
}
|
||||
|
||||
// Bucket is at subdomain: tia.<accountId>.r2.cloudflarestorage.com
|
||||
// Or path: <accountId>.r2.cloudflarestorage.com/tia
|
||||
const endpoint = bucket === "tia"
|
||||
? `https://${bucket}.${accountId}.r2.cloudflarestorage.com`
|
||||
: `https://${accountId}.r2.cloudflarestorage.com/${bucket}`;
|
||||
// Use public development URL (from R2 bucket settings)
|
||||
const pubBaseUrl = `https://pub-${accountId}.r2.dev/${bucket}`;
|
||||
|
||||
return {
|
||||
client: new S3Client({
|
||||
|
|
@ -25,7 +22,7 @@ function getR2() {
|
|||
credentials: { accessKeyId, secretAccessKey: secretKey },
|
||||
}),
|
||||
bucket,
|
||||
baseUrl: `https://${accountId}.r2.cloudflarestorage.com/${bucket}`,
|
||||
baseUrl: pubBaseUrl,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue