getStaticPaths with fallback: false, return 404 page for non-ASCII/non-Latin url
See original GitHub issueBug report
Describe the bug
In the following page called pages/a/[slug]/index.js
export async function getStaticPaths() {
return {
paths: [{ params: { slug: 'Synonyms' } }, { params: { slug: 'อักษรย่อ' } }],
fallback: false,
};
}
export async function getStaticProps({ params }) {
const res = await fetch(getApplicationDetailBySlug(params.slug));
const app = await res.json();
return {
props: { app },
};
}
The value of slug
is dynamic value that can be ASCII or Non-ASCII characters, So, When navigate to url of ASCII (Synonyms)
, Page rendered correctly but for Non-ASCII (อักษรย่อ)
, I got 404 page.
List of urls:
-
อักษรย่อ Url:
/a/อักษรย่อ
encodeURIComponent:/a/%E0%B8%AD%E0%B8%B1%E0%B8%81%E0%B8%A9%E0%B8%A3%E0%B8%A2%E0%B9%88%E0%B8%AD
-
Synonyms Url:
/a/Synonyms
encodeURIComponent:/a/Synonyms
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- in getStaticPaths(), Use url param with non-ascii characters, I think for all non-latin language will face this issue, e.g. Thai, Chinese, Japanese.
- fallback: false
- browse the url in browser.
- See 404 error page.
Expected behavior
Should return correctly of url path and param for all encoding in fallback: false
mode.
Screenshots
Page of non-ascii url:
Page of ascii url:
Result from build
command
Files from build
command in .next
folder:
System information
- OS: Windows 10 Pro (WSL Bash shell)
- Version of Next.js: 9.5.3
- Version of Node.js: v12.18.4
Additional context
OSX is got same behavior and 404 page. So, Path syntax is not root cause for this case for sure.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top GitHub Comments
same issue
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.