Description
Preliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
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
- Clone the repository
- npm install
- npm run build && npm run serve
- Open the page in a browser
- Open up browser developer tools and reload the page
- Click the network tab in Developer tools
- Click Fetch/XHR
- Click on page-data.json
- Check the Request URL: .../page-data/[...index]/page-data.json
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
System:
OS: macOS 13.1
CPU: (10) arm64 Apple M1 Max
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.12.1 - /usr/local/bin/node
npm: 8.19.2 - /usr/local/bin/npm
Browsers:
Chrome: 110.0.5481.177
Firefox: 108.0.2
Safari: 16.2
npmPackages:
gatsby: ^5.7.0 => 5.7.0
Config Flags
No response