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): skip encode non-urls #102

Merged
merged 3 commits into from Sep 23, 2019

Conversation

@curbengh
Copy link
Contributor

commented Sep 22, 2019

url.parse(str).slashes is used to avoid treating mailto: as a transfer protocol (e.g. http, ftp).

const { parse } = require('url')
console.log(parse('mailto:abc@example.com'))
/*
Url {
  protocol: 'mailto:',
  slashes: null,
  auth: 'abc',
  host: 'example.com',
  port: null,
  hostname: 'example.com',
  hash: null,
  search: null,
  query: null,
  pathname: null,
  path: null,
  href: 'mail:abc@example.com'
}
*/

This avoids null from being appended undesirably.


  • Expected behavior
encodeURL('mailto:abc@example.com')
// mailto:abc@example.com
  • Actual behavior
encodeURL('mailto:abc@example.com')
// mailto:abc@example.comnull

Address hexojs/hexo#3710 (comment)

curbengh added 3 commits Sep 20, 2019
@curbengh curbengh referenced this pull request Sep 22, 2019
1 of 2 tasks complete
@coveralls

This comment has been minimized.

Copy link

commented Sep 22, 2019

Coverage Status

Coverage increased (+0.02%) to 95.122% when pulling d56cd07 on curbengh:mailto into 486f4a0 on hexojs:master.

@coveralls

This comment has been minimized.

Copy link

commented Sep 22, 2019

Coverage Status

Coverage increased (+0.02%) to 95.122% when pulling 9e3af48 on curbengh:mailto into 486f4a0 on hexojs:master.

@curbengh curbengh referenced this pull request Sep 22, 2019
1 of 2 tasks complete
@SukkaW
SukkaW approved these changes Sep 22, 2019
@curbengh curbengh merged commit ceb307c into hexojs:master Sep 23, 2019
3 checks passed
3 checks passed
Travis CI - Pull Request Build Passed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
coverage/coveralls Coverage increased (+0.02%) to 95.122%
Details
@curbengh curbengh deleted the curbengh:mailto branch Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.