Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1323 from carrierwaveuploader/content-dispo

Fix issue with content-disposition existing with no filename when downloading
  • Loading branch information...
commit 565f19e369e0978af6d96809e2d955b6a9de129b 2 parents 02b9652 + 612b8cb
@bensie bensie authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/carrierwave/uploader/download.rb
View
4 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
Please sign in to comment.
Something went wrong with that request. Please try again.