From 96a041001b0e39f5370d4cc0a33f0a8f6adc4f15 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Wed, 11 Sep 2024 05:16:59 +0200 Subject: [PATCH] Stripping query for URL matching. --- src/dissectLink.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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, {