-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Which project does this relate to?
Router
Describe the bug
When using file-based routing in TanStack Router, if a folder name contains a space, the generated route includes %20 in the URL. While technically correct, it leads to awkward and less user-friendly URLs. It might be better to disallow spaces in folder names or automatically normalize them (e.g., replace with - or _) instead of producing %20 in the path.
Yeah, i know by default the browser will encode the space " " to %20 as seen in the first image

Question / Suggestion:
Would this be considered a bug or a feature request?
It might be useful if TanStack Router could either:
Warn or disallow spaces in folder names, or
Provide an option (e.g., via vite.config.ts) to normalize spaces automatically (e.g., convert to - or _), instead of producing %20 in the path.
Your Example Website or App
it is closed source
Steps to Reproduce the Bug or Issue
Steps to Reproduce
- Under the folder
routes/with a space in its name (e.g.folder/). - Add an
index.tsxinside it. - Start the dev server and open the route.
Result: URL becomes /%20folder.
Expected: Should warn or normalize instead of %20.
Expected behavior
Expected Behavior
Instead of producing %20 in the URL, TanStack Router should either:
- Warn or disallow spaces in folder names, or
- Normalize spaces automatically (e.g., replace with
-or_).
Screenshots or Videos
No response
Platform
- Router / Start Version:
v1.129.7 - OS: Mac
- Browser: Chrome and Dia
- Bundler: Vite
- Bundler Version: ^6.0.5
Additional context
No response
