next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Fix: Enable pages & app router file path to contain non-ascii UTF-8 words

Open coffeecupjapan opened this issue 1 year ago • 0 comments

What?

Fixes https://github.com/vercel/next.js/issues/10084 or https://github.com/vercel/next.js/issues/56047

In current behavior, page router and app router cannot recognize file path that contains non-ascii UTF-8 words. The easiest way to fix it is to call decodeURIComponent function for pathname passed from URL, since the regex that check whether inputted URL is valid or not contains raw non-ascii UTF-8 words (created using manifest file in prod, and using watchpack aggregation in dev). And I tried in my personal pages router and app router projects, and it works (not only dev mode but prod mode).

https://github.com/coffeecupjapan/NextJs_NonAsciiPages https://github.com/coffeecupjapan/NextJs_NonAsciiApp

But I cannot find out any vulnerabilities or affections caused by this PR. Since it is the easiest way, there may be better way to solve this.

coffeecupjapan avatar Feb 01 '24 12:02 coffeecupjapan