Skip to content

Commit

Permalink
fix: incorrectly checking if endpoint and urlMount start with a /
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael committed Nov 19, 2022
1 parent 915768f commit 761757d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/core/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
isObject,
isString,
extractMatchFromRegExp,
ensureLeadingSlash,
ensureLeadingToken,
stringReplacer,
argumentIsNotProvided,
combineStrings,
Expand Down Expand Up @@ -119,7 +119,7 @@ export function parseURIIntoComponent(
return convertStringToURIComponent(component);
} else if (allowEndpoints) {
return {
endpoint: ensureLeadingSlash(component)
endpoint: ensureLeadingToken("/", component)
};
} else {
throw new Error(
Expand All @@ -134,13 +134,18 @@ export function parseURIIntoComponent(
""
);

const endpoint = ensureLeadingToken("/", component.endpoint);
const urlMount = ensureLeadingToken("/", component.urlMount);

const buildableComponent = merge(component, {
protocol: protocol,
hostname: hostname
hostname: hostname,
endpoint: endpoint,
urlMount: urlMount
});

const componentAsString = convertURIComponentToString(buildableComponent);
const newComponent = convertStringToURIComponent(componentAsString, component.urlMount);
const newComponent = convertStringToURIComponent(componentAsString, urlMount);

return newComponent;
} else {
Expand Down

0 comments on commit 761757d

Please sign in to comment.