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

Request resource fail when the path has other language characters on SSR mode #6087

Closed
1 task done
QingXia-Ela opened this issue Feb 1, 2023 · 0 comments · Fixed by #6088
Closed
1 task done

Request resource fail when the path has other language characters on SSR mode #6087

QingXia-Ela opened this issue Feb 1, 2023 · 0 comments · Fixed by #6088

Comments

@QingXia-Ela
Copy link
Contributor

What version of astro are you using?

2.0.2

Are you using an SSR adapter? If so, which one?

node

What package manager are you using?

npm

What operating system are you using?

Windows

Describe the Bug

The resource will request fail when the path has Chinese on SSR mode with node. Only appear on build output server.

Snipaste_2023-02-01_23-35-37
Snipaste_2023-02-01_23-35-16

Maybe other language also has this problem?

I found that in the output server, the path will be encode one time:

const stream = send(req, encodeURI(pathname), {

But when the browser send the request with Chinese path, it has been encoded. But with second time encoded, it makes path become incorrent.

图片

Maybe should change like this:

const stream = send(req, encodeURI(decodeURI(pathname)), {
	root: fileURLToPath(client),
	dotfiles: pathname.startsWith('/.well-known/') ? 'allow' : 'deny',
});

Link to Minimal Reproducible Example

https://github.com/QingXia-Ela/astro-bug-demo

Participation

  • I am willing to submit a pull request for this issue.
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.

1 participant