Feature request: allow formats with dot in resourceful routing, like '/users.xml.zip'

I agree that it looks like a good solution to make middleware execute such straightforward tasks as compression, and only extend Rails URL helpers. I am not sure i would be able to do something about this myself, looks like more work than just changing the parsing rules.

All examples of double extensions i can think of would be of the following two types:

  1. a file foo.ext1.ext2 after some processing allows to recover the file foo.ext1.

Examples: foo.csv.zip, foo.tar.gz, foo.css.sass, foo.html.erb

  1. the first extension is a custom one, and the second is a “legal” one.

Examples: foo.source.txt, foo.miminized.js

I have no problem with the way double extensions are used for template engines in rails. It also makes a lot of sense, and since it really isn’t exposed publicly I think even though it represents things a little different than archiving and compression (index.html.erb isn’t really an HTML inside an ERB wrapper), it holds up. Just like the requester for a .csv.zip knows what to expect, the requester (rails) of a .html.haml knows what to expect.

As far as your second set of examples, in foo.minimized.js, the “.minimized” part isn’t really an extension; it’s just part of the file name. If someone named their vCard ‘John.Smith.vcf’, Smith isn’t an extension, they just happened to use a period in the file name. So I don’t think those examples really apply. “.minimized” is just convention, it could just as easily have been “foo-minimized.js” since the mine type or format is remaining the same.

Anyway, I think if we really only have these two strong cases for multiple extensions, handling them case-by-case will be fine, and middleware seems like the best option for zip/etc.

If a ressource is named “foo_minimized.js”, according to rails conventions for resourceful URLs, it would need to be processed by the controller “foo_minimized”, a different one than for “foo.js”.

Here is another example of how i personally sometimes use double extensions, this is a particular case of the first category i described above: i may add a more specific extension after a less specific, like in


This is in case i will ever send the file to someone who does not know about Markdown.

I remind that this thread in my opinion is about parsing resourceful URLs.