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

encoded url causing error when accessing via static mode #8679

Closed
c53hzn opened this issue Jan 22, 2021 · 7 comments · Fixed by #8738
Closed

encoded url causing error when accessing via static mode #8679

c53hzn opened this issue Jan 22, 2021 · 7 comments · Fixed by #8738
Assignees

Comments

@c53hzn
Copy link

c53hzn commented Jan 22, 2021

Versions

  • nuxt: 2.14.12
  • node: 15.6.0

Reproduction

https://github.com/c53hzn/c53hzn.github.io/tree/master/_nuxt/static/1611255759/blog/language
This is how the generated paths look like
image
And the encoded format will cause error when relevant pages try to extract data from the payload.

Additional Details

Steps to reproduce

if I go to a page with Chinese characters in path, the payloads generated won't work because the paths generated for payloads with encoded characters need to be encoded again before the payloads can be accessed
eg:
If I want to access the payloads generated for this path:
c53hzn.github.io/blog/language/中文

The payload is stored in this path:
c53hzn.github.io/_nuxt/static/1611321880/blog/language/%E4%B8%AD%E6%96%87/payload.js
Here "%E4%B8%AD%E6%96%87" is the encoded Chinese character "中文"

But in order to access this payload, the actual URL should be
c53hzn.github.io/_nuxt/static/1611321880/blog/language/%25E4%25B8%25AD%25E6%2596%2587/payload.js

What is Expected?

Static mode should generate payload path as is, rather than generate encoded paths.

What is actually happening?

Encoded paths cause errors when fetching data.

I think it's the same issue as this one #8680, and I followed @pi0 's advice and updated Nuxt, but the issue remains.

@c53hzn c53hzn changed the title state and payload generated for static mode cannot correctly parse Chinese and Japanese in url payload generated for static mode cannot correctly parse Chinese and Japanese in url Jan 22, 2021
@c53hzn c53hzn changed the title payload generated for static mode cannot correctly parse Chinese and Japanese in url encoded url causing error when accessing via static mode Jan 22, 2021
@pi0
Copy link
Member

pi0 commented Jan 22, 2021

Hi @c53hzn actually it is not related to URI malformed error in linked issue but it makes sense to use non-encoded path when writing static assets to disk

@c53hzn
Copy link
Author

c53hzn commented Jan 23, 2021

Hi @pi0
Thank you for your reply! Look forward to new changes 😃

@c53hzn
Copy link
Author

c53hzn commented Mar 25, 2021

Hi, I'm sorry to bother you guys again on this issue.
I updated Nuxt to the latest version, now the paths for storing the payloads seem to be OK, but the pages are still having trouble retrieving data. This only happens to full static mode, and I really don't know how to fix it.

eg:
For my blog tag page, I set data attributes as blog_by_year, tagName, ui_en, ui_zh, then I have a computed attribute ui_str
This is the page that works
https://www.houzhenni.com/blog/tag/vlookup
I can find the data attributes in the Vue instance
image

This is the page that doesn't work
https://www.houzhenni.com/blog/tag/面包屑导航
You can see that data attributes are no where to be found, but the computed attribute is here.
image

Can anyone help me on this?

@nexus-uw
Copy link

nexus-uw commented Aug 4, 2021

@c53hzn, where you able to resolve your issue? i am seeing the same issue when my path includes a space

@c53hzn
Copy link
Author

c53hzn commented Aug 4, 2021

@c53hzn, where you able to resolve your issue? i am seeing the same issue when my path includes a space

@nexus-uw Hi Simon, no, I was not able to solve this problem. I rolled back my website to use Nuxt v2.12.2, this version worked fine with paths that include spaces or other special characters.

@yshlin
Copy link

yshlin commented Jun 4, 2022

I have Chinese URLs encountering the same problem.
And I found that the encoding problem can be fixed by using decodeURI(route) here:
https://github.com/nuxt/nuxt.js/blob/v2.14.6/packages/vue-app/template/App.js#L308
I'm using v2.14.6 (haven't had time to upgrade to the latest version tho).

@weotch
Copy link

weotch commented Feb 8, 2023

I think this was fixed in #9494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants