From b0bcb4d28a7d6292ac54ad88c130aa27511f4063 Mon Sep 17 00:00:00 2001 From: Jez Date: Sat, 8 Nov 2025 15:08:37 +1100 Subject: [PATCH] fix: prevent double https:// in R2 public URLs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CLOUDFLARE_R2_URL environment variable already includes the protocol prefix (https://), so prepending another 'https://' results in malformed URLs like 'https://https://...'. This fix removes the hardcoded protocol prefix and uses the env var value directly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/lib/r2.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/r2.ts b/src/lib/r2.ts index 2fdc4f8..a3c1812 100644 --- a/src/lib/r2.ts +++ b/src/lib/r2.ts @@ -46,7 +46,8 @@ export async function uploadToR2( } // Return public URL of R2 (should be using custom domain) - const publicUrl = `https://${(env as any).CLOUDFLARE_R2_URL}/${key}`; + // CLOUDFLARE_R2_URL already includes the protocol (https://) + const publicUrl = `${(env as any).CLOUDFLARE_R2_URL}/${key}`; return { success: true,