Skip to content

Commit d2e7e26

Browse files
committed
avoid duplicate region prefix in getApiEndpoint for regional API URLs
1 parent 089ca52 commit d2e7e26

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/lib/stores/sdk.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ export function getApiEndpoint(region?: string): string {
5454
const hostname = url.host; // "hostname:port" (or just "hostname" if no port)
5555

5656
// If instance supports multi-region, add the region subdomain.
57-
const subdomain = isMultiRegionSupported(url) ? getSubdomain(region) : '';
57+
let subdomain = isMultiRegionSupported(url) ? getSubdomain(region) : '';
58+
if (subdomain && hostname.startsWith(subdomain)) {
59+
subdomain = '';
60+
}
5861

5962
return `${protocol}//${subdomain}${hostname}/v1`;
6063
}

0 commit comments

Comments
 (0)