Skip to content

encodeURL() rewrites the query string incorrectly #411

@axiac

Description

@axiac

Check List

  • I have already read README.
  • I have already searched existing issues and they are not help to me.
  • I examined error or warning messages and it's difficult to solve.
  • I am using the latest version of this repository.
  • I am using the latest version of Hexo.
  • My Node.js is matched the required version.

Describe the bug

encodeURL('https://www.wolframalpha.com/input?i=2%2B2') produces 'https://www.wolframalpha.com/input?i=2+2'.

i=2+2 is the URL encoding of i=2 2 which is, obviously, different than the input query string (which is the URL encoding of i=2+2).

Expected behavior

I got the input URL https://www.wolframalpha.com/input?i=2%2B2 from the browser's address bar. It works as expected in any browser.
When I put it (using copy-paste) in a post, I expect to get a link in the generated web page that uses the input URL as-is or, at least, in an equivalent representation.

There currently isn't any way to produce a valid URL encoding of i=2+2 in the query string.

How to reproduce

  1. Put the URL https://www.wolframalpha.com/input?i=2%2B2 into a post.
  2. Generate the site.
  3. Open the site in browser, click on the link, see what URL opens in browser.
    Compare with the result of pasting the URL above directly into the browser's address bar.

Screenshots

No response

Environment information

The relevant fragment of the output of `yarn list`:


yarn list v1.22.22
├─ ...
├─ hexo-cli@4.3.2
├─ hexo-front-matter@4.2.1
├─ hexo-fs@4.1.3
├─ hexo-generator-archive@2.0.0
├─ hexo-generator-category@2.0.0
├─ hexo-generator-feed@3.0.0
├─ hexo-generator-index@4.0.0
├─ hexo-generator-sitemap@3.0.1
├─ hexo-generator-tag@2.0.0
├─ hexo-i18n@2.0.0
├─ hexo-log@4.1.0
├─ hexo-pagination@3.0.0
├─ hexo-renderer-ejs@2.0.0
├─ hexo-renderer-marked@7.0.0
├─ hexo-renderer-stylus@3.0.1
├─ hexo-robots@1.0.1
├─ hexo-server@3.0.0
├─ hexo-theme-landscape@1.0.0
├─ hexo-util@3.3.0
├─ hexo@7.3.0
└─ ...
Done in 0.16s.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions