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

fix: encode URL by default #112

Merged
merged 4 commits into from Nov 8, 2019
Merged

fix: encode URL by default #112

merged 4 commits into from Nov 8, 2019

Conversation

curbengh
Copy link
Contributor

@curbengh curbengh commented Sep 8, 2019

url should always be encoded. replace part of sanitizeUrl function with encodeURL.

encodeURL is added in hexo-util 1.1.0.

Note the hostname is not encoded (into percent-encoding) to handle IDN properly.


Just noticed title="" and alt="" values (e.g. [foo](http://example.com "<bar>") and ![<foo>](image.jpg)) are automatically escaped by marked so escapeHTML() is not needed.

@coveralls
Copy link

coveralls commented Sep 8, 2019

Coverage Status

Coverage increased (+6.0%) to 93.478% when pulling 538252e on curbengh:sanitize-url into 9d3a38a on hexojs:master.

@curbengh curbengh requested a review from a team September 18, 2019 10:50
@curbengh curbengh requested review from a team and removed request for a team November 8, 2019 00:41
@curbengh
Copy link
Contributor Author

curbengh commented Nov 8, 2019

Ready for review. I intend to add external_link feature after this PR.

Copy link
Member

@SukkaW SukkaW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@curbengh curbengh merged commit 2394623 into hexojs:master Nov 8, 2019
@curbengh curbengh deleted the sanitize-url branch November 8, 2019 04:17
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

Successfully merging this pull request may close these issues.

None yet

3 participants