Open affemaen opened 1 year ago
Hi, thanks for the issue!
Feel free to put up a PR fixing this, for us it won't be a high priority as most other websites, browsers, and webservers handle square brackets just fine.
hm I'm still new to Gatsby but mabe you can manually encode the brackets in your splatroute. Instead of using [...] in your route definition, use %5B...%5D instead. For example, instead of defining your route as /page-data/[...index]/page-data.json, define it as /page-data/%5B...index%5D/page-data.json ?
Hola que tal disculpe por la inconformidad pero si estoy comentiendo algun error por favor aganmelo saber realmente no tengo conocimiento de esto si me pudieran guiar les agradeciera demasiado
Preliminary Checks
Description
When using splatroutes, a file called
/page-data/[...foobar]/page-data.json
is created and downloaded by Gatsby upon invoking that splatroute.The problem is that Gatsby is NOT escaping the brackets (
[]
) in the request fetching it, thus breaking the RFC3986 which prohibits the use of[]
in the path (unless encoded as%5B
/%5D
).Some webservers allow it, while others disallow it, some have undefined behaviour. Playframework is one of the few that actually asserts that they DON'T work in a test case. https://github.com/playframework/playframework/blob/main/core/play-integration-test/src/it/scala/play/it/http/BadClientHandlingSpec.scala#L58-L65
Reproduction Link
https://github.com/affemaen/gatspy-splat-route
Steps to Reproduce
Expected Result
The request url to fetch the page-data.json should be .../page-data/%5B...index%5D/page-data.json
Actual Result
The request url to fetch the page-data.json is actually .../page-data/[...index]/page-data.json
Environment
Config Flags
No response