[Bug] getRoutes children path is adding extra character at the end
When I set a nested page that contains the : character in the path argument within getRoutes of static.config.js I end up with an unwanted : character at the end of the resulting URL.
So for example, if I set the path to example:-post, the resulting URL will be example:-post:. For some reason the extra : character is being added at the end. This happens on dev and when doing yarn build.
When I prepend a parent path the string, everything works as expected. For example if I set the path to /post/example:-post instead, I DON'T end up with the extra : character.
NOTE: I only hardcoded the path string for debug purposes.
Here's some screenshots:

Then after doing yarn build:

Prepending a parent path works:

Then after doing yarn build:

Environment
System:
OS: macOS 10.15.2
CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
Memory: 317.23 MB / 8.00 GB
Shell: 5.7.1 - /bin/zsh
npmPackages:
@reach/router: ^1.2.1 => 1.2.1
axios: ^0.19.0 => 0.19.0
babel-eslint: ^10.0.2 => 10.0.3
eslint: ^6.1.0 => 6.8.0
eslint-config-react-app: ^5.0.1 => 5.1.0
eslint-config-react-tools: ^1.1.7 => 1.1.7
eslint-plugin-flowtype: ^4.2.0 => 4.5.2
eslint-plugin-import: ^2.18.2 => 2.19.1
eslint-plugin-jsx-a11y: ^6.2.3 => 6.2.3
eslint-plugin-react: ^7.14.3 => 7.17.0
jdown: ^1.0.3 => 1.0.3
react: ^16.9.0 => 16.12.0
react-dom: ^16.9.0 => 16.12.0
react-static: ^7.2.0 => 7.2.3
react-static-plugin-reach-router: ^7.2.0 => 7.2.3
react-static-plugin-sitemap: ^7.2.0 => 7.2.3
react-static-plugin-source-filesystem: ^7.2.0 => 7.2.3
serve: ^11.1.0 => 11.2.0
Binaries:
Node: 12.9.1 - /usr/local/bin/node
Yarn: 1.12.1 - /usr/local/bin/yarn
npm: 6.10.3 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Browsers:
Chrome: 79.0.3945.88
Safari: 13.0.4
Steps to Reproduce the problem
Base your steps off of any freshly installed react-static template!
- Create routes with nested blog post pages.
- Set the path string with a
:character without any prefix/parent path. eg.path: "example:-post" yarn build
Expected Behavior
It should not have the added : character at the end of the path.
Whilst I agree that there should probably not be an : added,
https://tools.ietf.org/html/rfc3986#page-13 https://tools.ietf.org/html/rfc3986#section-3.3
what exactly are you trying to do?
Also note that using : probably makes your build not work on some non-posix systems such as some environments of windows.
I’m migrating a blog site from Hugo and one of the path had a :.
I can easily just do a redirect to get around this but I still think it’s weird that there’s a : appended in the path when building.
Btw, this also happens when there’s a = character in the path.
Thanks. I put it on the list of weird things that shouldn't happen in the next major version. My guess is the current code base does some non-standard normalisation around paths.
(= characters should also not be present in the path part)