flak rss random

sinatra mime types

Sinatra (the ruby web app framework) has a handy method to indicate that the response is an attachment and should be saved: attachment filename. It even sets the content type correctly. Unless it can’t guess from the filename. Then it throws an unrecoverable error.

Discovered this little fact trying to download a .tgz file. The documentation says if I find a mime type Sinatra doesn’t understand, I’m supposed to run mime_type :tgz, 'application/octet-stream'. OK, great. So where’s the list of already known types? Never mind that, I’m really supposed to make up a list of every mime type I might want to download at some point and register them all up front? Insanity. In theory, I think rack is supposed to already be using a default of application/octet-stream, but it appears I’m just unlucky.

Posted 08 Apr 2012 02:40 by tedu Updated: 11 Apr 2013 21:34
Tagged: mailtanium rants software web