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

encodeURL() rewrites the query string incorrectly #411

Open
6 tasks done
axiac opened this issue Feb 8, 2025 · 1 comment · May be fixed by #413
Open
6 tasks done

encodeURL() rewrites the query string incorrectly #411

axiac opened this issue Feb 8, 2025 · 1 comment · May be fixed by #413

Comments

@axiac
Copy link

axiac commented Feb 8, 2025

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
├─ ...
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ ...
Done in 0.16s.

Additional context

No response

uiolee added a commit to uiolee/hexo-util that referenced this issue Feb 8, 2025
@uiolee uiolee linked a pull request Feb 8, 2025 that will close this issue
2 tasks
@uiolee
Copy link
Member

uiolee commented Feb 8, 2025

hexo-util

parsed.search = encodeURI(unescape(parsed.search));

hexo-renderer-marked

https://github.com/hexojs/hexo-renderer-marked/blob/7e5dde1ff314e1777594a0b68dce6ead5519fa7f/lib/renderer.js#L93

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 a pull request may close this issue.

2 participants