From 782ea1ea3837cacb599c9e67c2931d0a555fd269 Mon Sep 17 00:00:00 2001 From: Kenneth Hendricks <50819541+kenhendricks00@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:35:49 -0400 Subject: [PATCH] Update background.js Updated RegEx --- platform/firefox/js/background.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/firefox/js/background.js b/platform/firefox/js/background.js index de1c0cd..523fb1b 100644 --- a/platform/firefox/js/background.js +++ b/platform/firefox/js/background.js @@ -28,9 +28,12 @@ function extractUrlsFromBookmarks(html) { return urls; } -// Helper function to normalize URLs (removes trailing slashes) +// Helper function to normalize URLs (removes trailing slashes, query parameters, and fragments) function normalizeUrl(url) { - return url.replace(/\/+$/, ""); // Remove trailing slash only, no www. removal + const urlObj = new URL(url); + urlObj.search = ""; // Remove query parameters + urlObj.hash = ""; // Remove fragments + return urlObj.href.replace(/\/+$/, ""); // Remove trailing slash only } // Helper function to extract root domain from URL