Add R2 public URL to storage tests

This commit is contained in:
thePR0M3TH3AN committed 2026-01-25 20:44:21 -05:00
1 parent a923ce57c8
commit e096a8b136
1 file changed
+16
+16
View File
@@ -9294,12 +9294,26 @@ export class ProfileModalController {
const secretAccessKey = this.storageSecretKeyInput?.value?.trim() || "";
const bucket = this.storageBucketInput?.value?.trim() || "";
const forcePathStyle = provider === PROVIDERS.GENERIC;
const publicBaseUrl = this.storagePrefixInput?.value?.trim() || "";
if (!accessKeyId || !secretAccessKey || !endpointOrAccount) {
this.setStorageFormStatus("Missing credentials for test.", "error");
return;
}
if (
provider === "cloudflare_r2" &&
(publicBaseUrl.includes(".r2.cloudflarestorage.com") ||
publicBaseUrl.includes(".s3.") ||
publicBaseUrl.includes(".amazonaws.com"))
) {
this.setStorageFormStatus(
"Invalid Public URL. Please use your R2.dev or custom domain.",
"error",
);
return;
}
this.setStorageFormStatus("Testing connection...", "info");
const config = {
@@ -9312,6 +9326,8 @@ export class ProfileModalController {
if (provider === "cloudflare_r2") {
config.accountId = endpointOrAccount;
config.publicBaseUrl = publicBaseUrl;
config.baseDomain = publicBaseUrl;
} else {
config.endpoint = endpointOrAccount;
config.forcePathStyle = forcePathStyle;