Permalink
Browse files

Fix issue with content-disposition existing with no filename when dow…

…nloading
  • Loading branch information...
1 parent 02b9652 commit 3f221b2944432fa78fc14be52038503cac9568f2 @bensie bensie committed Feb 18, 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 ] if !match.nil? && !match[ 1 ].empty?
end
end

0 comments on commit 3f221b2

Please sign in to comment.