question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trim params wildcard inconsistency

See original GitHub issue

This had me confused for quite a while with parameters being trimmed that I didn’t intend until I added debug logging manually to see what was going on. Basically when a filter rule’s Trim URL Parameters value contains more than 1 asterisk, the first asterisk is replaced by the regex pattern .* but all the others are left alone.

Personally I’d prefer to just work with regex, but I understand the asterisk replacement is there so users don’t have to know regex and to be somewhat consistent with the pattern matching for hosts/paths. It’s a bit awkward that it’s actually a regex except for the asterisk because it means you can’t use an asterisk in any regex context other than .* (unless you abuse this bug and know that only the first asterisk works like that).

The obvious fix is to replace .replace("*", ".*") with .replace(/\*/g, ".*") so all asterisks are replaced, not just the first. A more complete solution might allow the user to deliberately indicate a particular parameter is a regex (eg /to_be_trim*ed/) whilst properly treating all others as literal strings, but that seems like a lot of work to get right and performant!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
tumpiocommented, Jun 27, 2017

I added regexp escaping and fixed the logic bug 👍

beta version for testing: https://addons.mozilla.org/addon/requestcontrol/versions/1.7.0beta2

0reactions
tumpiocommented, Jul 1, 2017

Argh… onInstalled API documentation didn’t mention anything that the “previousVersion” property is available starting from version 55 of Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1313648

I added a fallback for it and I’ve now disabled 1.7.0 in AMO.

If you didn’t do any changes to the rules, you should be able to migrate them installing 1.7.1beta3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Confused with -Include parameter of the Get-ChildItem cmdlet
Enter a path element or pattern, such as "*.txt". Wildcards are permitted. The Include parameter is effective only when the command includes the ......
Read more >
HANDLECOLLISIONS | NOHANDLECOLLISIONS
Use the HANDLECOLLISIONS and NOHANDLECOLLISIONS parameters to control whether or not Replicat tries to resolve duplicate-record and missing-record errors ...
Read more >
Inconsistencies between Get-ChildItem and Remove-Item with ...
When it is used with the Include parameter, the Recurse parameter might not delete all subfolders or all child items. This is a...
Read more >
MAP( ) function
Returns a logical value indicating if a character string matches a specified format string containing wildcard characters, literal characters, or both.
Read more >
Advanced Settings | Kibana Guide [8.5] - Elastic
Allows a wildcard (*) as the first character in a query clause. Only applies when experimental query features are enabled in the query...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found