Skip to content

Routes with file extensions stopped working after 0.6.1 #45

@eivindgi

Description

@eivindgi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions