uri-templates icon indicating copy to clipboard operation
uri-templates copied to clipboard

Fix for notReallyPercentEncode

Open enriched opened this issue 7 years ago • 2 comments

notReallyPercentEncode was ignoring double encoded things that ended with a letter.

enriched avatar Feb 09 '18 21:02 enriched

Why not /%25[0-9a-fA-F][0-9a-fA-F]/g? What is this doing exactly? :P

jwalton avatar Apr 11 '18 00:04 jwalton

This function is trying to undo percent encoded stuff that got percent encoded again. So the regex is meant to match things that are are percent encoded (start with the % character) followed by the hexadecimal value for percent (25), followed by a hexadecimal ascii character [0-9][0-9a-fA-F]. I am not sure if it makes a difference if you allow [0-9a-fA-F] on the first character, but the [0-9] should match a character that has been encoded.

It would probably be even better to only match the hexadecimal of characters that get encoded.

enriched avatar Apr 20 '18 18:04 enriched