Permalink
Browse files

Merge pull request #1323 from carrierwaveuploader/content-dispo

Fix issue with content-disposition existing with no filename when downloading
  • Loading branch information...
2 parents 02b9652 + 612b8cb commit 565f19e369e0978af6d96809e2d955b6a9de129b @bensie bensie committed Feb 24, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/carrierwave/uploader/download.rb
@@ -48,8 +48,8 @@ def file
def filename_from_header
if file.meta.include? 'content-disposition'
- match = file.meta['content-disposition'].match(/filename=(\"?)(.+)\1/)
- return match[2] unless match.nil?
+ match = file.meta['content-disposition'].match(/filename="?([^"]+)/)
+ return match[1] unless match.nil? || match[1].empty?
end
end

0 comments on commit 565f19e

Please sign in to comment.