Loader
does not decode pathPrefix correctly
#30533
Labels
topic: core
Relates to Gatsby's core (e.g. page loading, reporter, state machine)
type: bug
An issue or pull request relating to a bug in Gatsby
Description
Supplying an unencoded pathPrefix, such as
/امتحان
fails validation with an error message:"pathPrefix" must be a valid relative uri
.So one can supply something like
pathPrefix: "/" + encodeURI("امتحان"),
which solves that problem but then the app is not functional:The issue looks to stem from these lines of code: https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/cache-dir/find-path.js#L9-L11
The matching decodes the pathname uri, but because the path_prefix is not decoded it will fail to match.
Steps to reproduce
https://github.com/herecydev/encoding-path-prefix-bug
yarn build
yarn serve
http://localhost:9000/%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86/
Expected result
Either the config should allow an unencoded pathPrefix or
loader
can correctly encode/decode when it needs toActual result
Gatsby loader fails to decode the pathPrefix
Environment
The text was updated successfully, but these errors were encountered: