uri-templates
uri-templates copied to clipboard
Fix for notReallyPercentEncode
notReallyPercentEncode was ignoring double encoded things that ended with a letter.
Why not /%25[0-9a-fA-F][0-9a-fA-F]/g
? What is this doing exactly? :P
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.