diff --git a/api/src/utils/helpers/URL.ts b/api/src/utils/helpers/URL.ts index 5401660..df1426b 100644 --- a/api/src/utils/helpers/URL.ts +++ b/api/src/utils/helpers/URL.ts @@ -1,6 +1,10 @@ export const buildURL = (baseUrl: string, relativePath: string): string => { try { - const url = new URL(relativePath, baseUrl); + const normalizedBaseUrl = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`; + const normalizedRelativePath = relativePath.startsWith('/') + ? relativePath.slice(1) + : relativePath; + const url = new URL(normalizedRelativePath, normalizedBaseUrl); return url.toString(); } catch {