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(open_graph): percent-encode url, not html escape #3686

Merged
merged 10 commits into from Oct 8, 2019

Conversation

@curbengh
Copy link
Contributor

curbengh commented Aug 24, 2019

root/path value should be percent-encoded, not html escaped.

What does it do?

_config.yml
url: https://日本語テストgôg.com/hexô-testing

Current behavior

<meta property="og:url" content="https://&#x65E5;&#x672C;&#x8A9E;&#x30C6;&#x30B9;&#x30C8;g&#xF4;g.com/hex&#xF4;-testing/index.html">

Expected behavior

<meta property="og:url" content="https://xn--gg-8ja8200c3ban0926g0ecl32k.com/hex%C3%B4-testing/index.html">

How to test

git clone -b url-encoding https://github.com/curbengh/hexo.git
cd hexo
npm install
npm test

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.
@coveralls

This comment has been minimized.

Copy link

coveralls commented Aug 24, 2019

Coverage Status

Coverage decreased (-0.002%) to 97.297% when pulling 6f7fe0c on curbengh:url-encoding into 18d459f on hexojs:master.

@curbengh curbengh mentioned this pull request Sep 2, 2019
@curbengh

This comment has been minimized.

Copy link
Contributor Author

curbengh commented Sep 2, 2019

@curbengh curbengh force-pushed the curbengh:url-encoding branch from bf3969a to 8b50de3 Sep 26, 2019
@curbengh curbengh changed the title fix(open_graph): support IDN url fix(open_graph): encode url Sep 26, 2019
@curbengh curbengh added this to the v4.0.0 milestone Sep 26, 2019
@curbengh curbengh added this to In progress in v4.0.0 via automation Sep 26, 2019
@curbengh curbengh moved this from In progress to To do in v4.0.0 Sep 26, 2019
@curbengh curbengh force-pushed the curbengh:url-encoding branch 2 times, most recently from 0f021a6 to 8bffea1 Sep 27, 2019
@curbengh curbengh changed the title fix(open_graph): encode url fix(open_graph): root/path value should be percent-encoded, not html escaped. Sep 27, 2019
@curbengh curbengh changed the title fix(open_graph): root/path value should be percent-encoded, not html escaped. fix(open_graph): percent-encode url, not html escape Sep 27, 2019
@curbengh curbengh requested a review from hexojs/core Oct 1, 2019
Copy link
Contributor Author

curbengh left a comment

comment removed

@@ -41,7 +41,7 @@ describe('asset_img', () => {
});

it('default', () => {
assetImg('bar title').should.eql('<img src="/foo/bar" class="" title="title">');
assetImg('bar "a title"').should.eql('<img src="/foo/bar" class="" title="a title">');

This comment has been minimized.

Copy link
@curbengh

curbengh Oct 8, 2019

Author Contributor

@SukkaW

hexojs/hexo-util@622167f could have undesired output when

htmlTag('a', { src: '/foo/', title: 'title', alt: 'alt' }, 'text')

title and alt are incorrectly seen as boolean. It's a very rare edge case (title="title" is valid but bad practice), so I don't mind keeping hexojs/hexo-util@622167f, just fyi.

@curbengh curbengh force-pushed the curbengh:url-encoding branch from 956286d to 6f7fe0c Oct 8, 2019
v4.0.0 automation moved this from To do to In progress Oct 8, 2019
@SukkaW
SukkaW approved these changes Oct 8, 2019
@curbengh curbengh merged commit d2662d4 into hexojs:master Oct 8, 2019
3 of 4 checks passed
3 of 4 checks passed
coverage/coveralls Coverage decreased (-0.002%) to 97.297%
Details
Travis CI - Pull Request Build Passed
Details
codeclimate 2 fixed issues
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
v4.0.0 automation moved this from In progress to Done Oct 8, 2019
@curbengh curbengh deleted the curbengh:url-encoding branch Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
v4.0.0
  
Done
3 participants
You can’t perform that action at this time.