Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

normalizeLinkText mangles links containing %25 #720

Closed
sophiebits-humu opened this issue Oct 13, 2020 · 4 comments
Closed

normalizeLinkText mangles links containing %25 #720

sophiebits-humu opened this issue Oct 13, 2020 · 4 comments

Comments

@sophiebits-humu
Copy link

sophiebits-humu commented Oct 13, 2020

If you normalize a URL that has something that looks like a double-escaped character, normalizeLinkText changes the meaning:

new MarkdownIt().normalizeLinkText('https://www.google.com/search?q=hello%252Fhello');
// https://www.google.com/search?q=hello%2Fhello

Note that the input is a Google search for the term hello%2Fhello; the second is hello/hello, so normalizeLinkText has changed the meaning.

(It's uncommon to do this but it is needed sometimes – what if you did want to search for hello%2Fhello?)

Compare this to a similar example with %26:

new MarkdownIt().normalizeLinkText('https://www.google.com/search?q=hello%26hello');
// 'https://www.google.com/search?q=hello%26hello'

Here, normalization knows not to convert this to ?q=hello&hello because & has special meaning in a URL. The same treatment that applies to %26 should apply to %25 as well because % has special meaning in a URL too.

Tested with 11.0.1.

@sophiebits-humu
Copy link
Author

Correct. (I happened upon this via Atlassian's AtlasKit project's rich text editor, which calls normalizeLinkText directly.)

@rlidwka
Copy link
Member

rlidwka commented Oct 14, 2020

Added % to exception list, I hope it solves this.

@sophiebits-humu
Copy link
Author

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants