missing file extension #1248

merged 1 commit into from Feb 18, 2014


None yet

4 participants


This addresses the bug in #1247

@NielsKSchjoedt NielsKSchjoedt commented on the diff Oct 21, 2013
@@ -17,11 +17,12 @@ def initialize(uri)
def original_filename
- if file.meta.include? 'content-disposition'
NielsKSchjoedt Oct 21, 2013

Would it be an idea to do some method caching here? (put the result into an instance variable e.g. @original_filename)

I would actually suggest that the default was changed so that it prefers to set the mime-type from the content_type and then falls back to the extension, if it's not there. I think browsers does the same?

def original_filename
   return @original_filename unless @original_filename.nil?
   filename = filename_from_header || File.basename(file.base_uri.path)
   mime_type = MIME::Types[file.content_type].first
   filename = "#{filename}.#{mime_type.extensions.first}" unless mime_type.blank?
   @original_filename = filename

Here is an example os an image that has an extension, but is actually an jpeg image:

@bensie bensie merged commit 11e35cd into carrierwaveuploader:master Feb 18, 2014

1 check passed

default The Travis CI build passed
synth commented on e3a46e2 Feb 25, 2014

awesome commit! Oauth'ing with a google apps domain returns a url to an avatar that contains the header


This fixed that. What the hell google?

So this is broken in official release 0.9.0 but fixed with latest which includes this commit. Any word on when this will be an official release? There should be probably be a wiki entry on this at very least.


Soon :)

Can you confirm that you're using the very latest master and that commit 3f221b2 works for you as expected? Regex was slightly changed and just want to make sure all is well.

Yes, I"m testing now in our staging site with commit: 565f19e and all looks well :)


Cool, I'll probably push 0.10.0 out this week.


Released :)

sweet thanks!

@nanonanomachine nanonanomachine referenced this pull request in nanonanomachine/private_matome Aug 4, 2014

Can't save image without extension #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment