Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routes with file extensions stopped working after 0.6.1 #45

Open
eivindgi opened this issue May 7, 2024 · 0 comments · May be fixed by #46
Open

Routes with file extensions stopped working after 0.6.1 #45

eivindgi opened this issue May 7, 2024 · 0 comments · May be fixed by #46

Comments

@eivindgi
Copy link

eivindgi commented May 7, 2024

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

  1. run npm install && npm run routes-gen && npm run dev
  2. Click on any of the two generated pdf links on the index page ("Download Foo as a pdf")
  3. 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

@eivindgi eivindgi linked a pull request May 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant