File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,9 @@ export function getRegionSubdomain(region?: string): string {
6666
6767/**
6868 * Builds the `/v1` API base URL (protocol + host + `/v1`).
69- * When `isMultiRegion` is true, strips any known region prefix from the host, then prepends the requested region.
69+ * When `isMultiRegion` is true and a region is selected, strips any known region prefix from the host,
70+ * then prepends that region. If multi-region is on but no region is requested (`region` missing or
71+ * unknown), the hostname is left unchanged so a default region baked into `APPWRITE_ENDPOINT` is kept.
7072 */
7173export function buildRegionalV1Endpoint (
7274 protocol : string ,
@@ -78,8 +80,11 @@ export function buildRegionalV1Endpoint(
7880 return `${ protocol } //${ hostname } /v1` ;
7981 }
8082
81- const hostWithoutRegion = stripLeadingRegionSubdomain ( hostname ) ;
8283 const subdomain = getRegionSubdomain ( region ) ;
84+ if ( ! subdomain ) {
85+ return `${ protocol } //${ hostname } /v1` ;
86+ }
8387
88+ const hostWithoutRegion = stripLeadingRegionSubdomain ( hostname ) ;
8489 return `${ protocol } //${ subdomain } ${ hostWithoutRegion } /v1` ;
8590}
You can’t perform that action at this time.
0 commit comments