Don't decode url before encoding it again#179
Merged
jgm merged 3 commits intocommonmark:masterfrom Jan 9, 2020
Merged
Conversation
Member
|
Test failure is It seems to me that the change in output is unproblematic; do you agree? |
Contributor
|
Could we please also add the broken example in this PR ( |
Contributor
Author
|
Alright, I just added a fix to the existing regression test as well as adding a |
Contributor
Author
|
I also just removed the (fyi: there seems to be no lint rule warning about unused variables) |
Member
|
Thanks! And thanks for the lint suggestion. I added the rule and found another unused variable. |
colinodell
added a commit
to thephpleague/commonmark
that referenced
this pull request
Jan 9, 2020
We previously did this in commit 92ab7cb, but due to an upstream change in commonmark/commonmark.js#179 we'll be adopting that new approach instead. Essentially, this change removes the decoding step prior to decoding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Decoding before encoding leads to invalid urls. Here's an example:
Let's assume this markdown:
This results in:
since
%bais a potential percentage-encoded hex code, mdurl's encode doesn't change it. resulting in an invalid link.As far as I'm aware, just doing
encode(uri)is doing the desired thing. for all kinds of uris