diff --git a/src/dissectLink.js b/src/dissectLink.js index 061d057..3ea065c 100644 --- a/src/dissectLink.js +++ b/src/dissectLink.js @@ -118,7 +118,9 @@ module.exports = function dissectLink(url) { return acc; } - const match = host.pattern.match(url.replace(/(https?:\/\/)|(\/)+/g, '$1$2')); // remove double slashes + // const match = host.pattern.match(url.replace(/(https?:\/\/)|(\/)+/g, '$1$2')); // remove double slashes + const { origin, pathname } = new URL(url); + const match = host.pattern.match(`${origin}${pathname}`); // remove double slashes if (match) { return Object.assign(match, {