mirror of
https://github.com/hexastack/hexabot
synced 2024-11-24 04:53:41 +00:00
Merge branch 'Hexastack:main' into fix-issue-45
This commit is contained in:
commit
e85e6dcec4
@ -1,9 +1,14 @@
|
||||
export const buildURL = (baseUrl: string, relativePath: string): string => {
|
||||
try {
|
||||
const url = new URL(relativePath, baseUrl);
|
||||
|
||||
return url.toString();
|
||||
return new URL(relativePath).toString();
|
||||
} catch {
|
||||
throw new Error(`Invalid base URL: ${baseUrl}`);
|
||||
try {
|
||||
return new URL(
|
||||
relativePath.replace(/^\//, ''),
|
||||
baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`,
|
||||
).toString();
|
||||
} catch {
|
||||
throw new Error(`Invalid base URL: ${baseUrl}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -28,11 +28,16 @@ export const getFromQuery = ({
|
||||
|
||||
export const buildURL = (baseUrl: string, relativePath: string): string => {
|
||||
try {
|
||||
const url = new URL(relativePath, baseUrl);
|
||||
|
||||
return url.toString();
|
||||
return new URL(relativePath).toString();
|
||||
} catch {
|
||||
throw new Error(`Invalid base URL: ${baseUrl}`);
|
||||
try {
|
||||
return new URL(
|
||||
relativePath.replace(/^\//, ""),
|
||||
baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`,
|
||||
).toString();
|
||||
} catch {
|
||||
throw new Error(`Invalid base URL: ${baseUrl}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user