config: preserve query params in Conf.local
This commit is contained in:
parent
b81091f5da
commit
93f06fd342
|
@ -72,14 +72,15 @@ const Conf = {
|
||||||
},
|
},
|
||||||
/** Merges the path with the localDomain. */
|
/** Merges the path with the localDomain. */
|
||||||
local(path: string): string {
|
local(path: string): string {
|
||||||
if (path.startsWith('/')) {
|
const url = new URL(path.startsWith('/') ? path : new URL(path).pathname, Conf.localDomain);
|
||||||
// Path is a path.
|
|
||||||
return new URL(path, Conf.localDomain).toString();
|
if (!path.startsWith('/')) {
|
||||||
} else {
|
// Copy query parameters from the original URL to the new URL
|
||||||
// Path is possibly a full URL. Replace the domain.
|
const originalUrl = new URL(path);
|
||||||
const { pathname } = new URL(path);
|
url.search = originalUrl.search;
|
||||||
return new URL(pathname, Conf.localDomain).toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return url.toString();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue