Fix decoding entire pathname edge cases #192
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #191
One caveat with this change is that all invalid/reserved URI characters will now be encoded. This is necessary to prevent something like
\
from appearing and then v8 flipping that to a/
. This URL is an example of how things go wrong with%5C
being decoded to\
, then getting flipped to/
by theURL
class. This is a valid URL that you can visit in your browser to see the image.https://tourpic-vector.maps.komoot.net/r/big/u%60t%5Be_pC~EzKnI%60p@h@nf@xFzJeB~EdQdXbH%60e@pHvOsAxp@lO%60VnA%7CVvyAhnAbYff@~P~ItT%5CjNjm@%7CQtU/?width=768&height=576&crop=true
However, if you run it through
normalize-url
, it will no longer map to the same resource on Komoot. Instead, you end up with this URL.https://tourpic-vector.maps.komoot.net/r/big/u%60t[e_pC~EzKnI%60p@h@nf@xFzJeB~EdQdXbH%60e@pHvOsAxp@lO%60VnA%7CVvyAhnAbYff@~P~ItT/jNjm@%7CQtU/?width=768&height=576&crop=true