-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Describe the bug
Routes with file extensions are not being handled correctly. Currently, when using the route function with a path that includes a file extension, such as /:id.pdf
, and providing an id parameter, the resulting path remains unchanged.
Your Example Website or App
https://stackblitz.com/edit/node-yxbgqj?file=package.json,app%2Froutes%2F%24id[.pdf].ts
Steps to Reproduce the Bug or Issue
On the stackblitz example
- run
npm install && npm run routes-gen && npm run dev
- Click on any of the two generated pdf links on the index page ("Download Foo as a pdf")
- You will get an 404
I have created a route called $id[.pdf].tsx (intended to be a resource route for downloading pdfs)
route('/:id.pdf', {id: 'foo'})
passes type checks but the resulting path is wrong (:id.pdf
)
Expected behavior
The :id
placeholder in the path should be replaced with the provided id
parameter, resulting in a path like /foo.pdf
.
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
- Version: 124
Additional context
This naming convention with file extension is suggested by remix here: https://remix.run/docs/en/main/guides/resource-routes