fgrehm / letter_opener_web

A web interface for browsing Ruby on Rails sent emails
MIT License
711 stars 111 forks source link

Allow dot in attachment name #131

Closed stevenharman closed 4 months ago

stevenharman commented 6 months ago

The primary change (in its own commit for clarity) is to allow dot (.) characters in attachment file name. The default constraint on segments does not allow dots, so requests for attachments with a dot in the file name wouldn't find a route, resulting in a 404 out of the Rails router.

The other commits are appeasing Rubocop.

An alternative approach

There are likely other characters allowed in file names, but disallowed in the path of a URL. If we'd also like to handle those, we could change the way we pass the attachment file name to use a query param. So the route would change to something like:

GET /letter_opener/:id/attachment?filename=some.file.ext

The filename param would also be URL encoded to make it safe. If you like this idea, I can adjust this PR to use that approach. Or, just roll with this one as-is and deal with that later, if someone needs it.

stevenharman commented 6 months ago

👋 Hello @fgrehm, and thank you for letter_opener_web. I know being an OSS maintainer is a largely thankless job, and we're often focused elsewhere. As we actively use this tool at my day job, I'd be happy to lend a hand in managing PRs and such? And even cutting a new release on RubyGems, if you're looking for help there.

Thank you, again!

fgrehm commented 4 months ago

Hey @stevenharman! Sorry for the delay and sure, I could use some help here! I'll try to cycle back to this next week :crossed_fingers: