From d2e7e263fe1751df143bf26e79b8a74fabe08a8d Mon Sep 17 00:00:00 2001 From: Harsh Mahajan Date: Sun, 29 Mar 2026 15:16:03 +0530 Subject: [PATCH] avoid duplicate region prefix in getApiEndpoint for regional API URLs --- src/lib/stores/sdk.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/stores/sdk.ts b/src/lib/stores/sdk.ts index b9c4cedca2..f2cd9920cc 100644 --- a/src/lib/stores/sdk.ts +++ b/src/lib/stores/sdk.ts @@ -54,7 +54,10 @@ export function getApiEndpoint(region?: string): string { const hostname = url.host; // "hostname:port" (or just "hostname" if no port) // If instance supports multi-region, add the region subdomain. - const subdomain = isMultiRegionSupported(url) ? getSubdomain(region) : ''; + let subdomain = isMultiRegionSupported(url) ? getSubdomain(region) : ''; + if (subdomain && hostname.startsWith(subdomain)) { + subdomain = ''; + } return `${protocol}//${subdomain}${hostname}/v1`; }