-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Astro Info
Astro : v5.15.1
Vite: v6.4.1
Node: v20.11.0
System: Windows(x64)
package Manager: pnpm
Output: Static
Adapter: None
Integrations: @astrojs/tailwind (v6.0.2)
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
In our project, we’re using a route structure like this:
src/pages/[path]/[slug]/[page].astro
Instead of a rest parameter (e.g. [...params].astro) because our organization uses Perforce, which doesn’t properly handle folders with ... in their names.
However, when the slug parameter is empty, the route fails to load in the dev server — it throws a 404 or doesn’t resolve the page at all.
If we explicitly pass the slug as ".", the project builds and works as expected, but this is obviously not a valid workaround.
Steps to Reproduce
-
Create a page structure:
src/pages/[path]/[slug]/[page].astro -
Try accessing a route where
slugis empty (e.g./blog//page-name). -
Observe that it fails in dev but works in the build if
slugis".".
[200] /path/slug/test 4ms
[404] /path//test 1ms
Environment
- Perforce integration: Yes (rest parameter
[...params]not usable due to Perforce folder restrictions)
Additional Context
We’re avoiding rest parameters ([...params].astro) because Perforce does not detect or sync such folders correctly.
Any workaround would be appreciated. We are using it in production and need to cover this usecase.
Thanks
What's the expected result?
- The route should handle empty or missing slug values gracefully in the dev server, just like it does when building the project.
- The behaviour between dev and build should be consistent.
Link to Minimal Reproducible Example
Participation
- I am willing to submit a pull request for this issue.