diff --git a/clearurls.js b/clearurls.js index b8514be..a7c03ad 100644 --- a/clearurls.js +++ b/clearurls.js @@ -364,7 +364,13 @@ function start(items) */ if(existsFields(url)) { - fields = url.replace(new RegExp(".*\\?", "i"), ""); + /** + * It must be non-greedy, because by default .* will match + * all ? chars. So the replace function delete everything + * before the last ?. With adding a ? on the quantifier *, + * we fixed this problem. + */ + fields = url.replace(new RegExp(".*?\\?", "i"), ""); for (var i = 0; i < rules.length; i++) { var beforReplace = fields; diff --git a/manifest.json b/manifest.json index f3e1ec5..e797729 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "ClearURLs", - "version": "1.3.3.3", + "version": "1.3.3.4", "author": "Kevin R.", "description": "Remove tracking elements form URLs.", "homepage_url": "https://gitlab.com/KevinRoebert/ClearUrls",