The splitt function for the fields was a greedy function and splitt at the last question mark, but it should splitt at the last question mark. So now the splitt function is a non-greedy function.
This commit is contained in:
Kevin Röbert 2018-06-25 21:58:07 +02:00
parent d51b49b40c
commit e001144d1a
2 changed files with 8 additions and 2 deletions

View File

@ -364,7 +364,13 @@ function start(items)
*/ */
if(existsFields(url)) 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++) { for (var i = 0; i < rules.length; i++) {
var beforReplace = fields; var beforReplace = fields;

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "ClearURLs", "name": "ClearURLs",
"version": "1.3.3.3", "version": "1.3.3.4",
"author": "Kevin R.", "author": "Kevin R.",
"description": "Remove tracking elements form URLs.", "description": "Remove tracking elements form URLs.",
"homepage_url": "https://gitlab.com/KevinRoebert/ClearUrls", "homepage_url": "https://gitlab.com/KevinRoebert/ClearUrls",