A route with a path parameter is not matched if the path parameter value contains a dot
Maritims opened this issue · 2 comments
When you have a route with a path parameter you won't be able to navigate to the route if your path parameter value contains a dot.
Steps to reproduce the behavior:
- Create a route which expects a path parameter, for instance "/foo/:bar"
- Attempt to access the route in your browser by going to for instance "/foo/bar.baz"
- Experience a 404 error
Expected behavior
As the dot character is not a reserved sign it does not need to be URL encoded. I expect to be able to navigate to a route with a path parameter value containing a dot.
- OS: Arch Linux 64-bit
- Browser: Chromium
- Version: 97.0.4692.71
I tried this quickly in the repl and I can't reproduce the error. But since you mention a 404 error, could it be that your server is not correctly setup for single page routing? Are you experiencing the issue in your dev environment? If so, what dev setup are you using? If you're using sirv, try passing the --single
flag to it.
@mefechoel I am indeed experiencing this in my dev environment. I gotta admit, Svelte is still pretty new to me but I was under the impression that I had the correct configuration for single page routing.
I tried adding the --single
flag to the sirv call in my rollup.config.js
now and that solved it. I see it's referenced in the project readme and I'd forgotten to do that.
Thanks! :)