about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-08-02 11:21:10 +0200
committerGitHub <noreply@github.com>2020-08-02 11:21:10 +0200
commita1412491b76ca37ca668083d2958fccf750a5fd3 (patch)
tree1689d75b25f994579f2ed4b37ae08fddaf49c8d9 /lib
parent9490011226e69426faefbfca02e5566cef369774 (diff)
Change content-type to be always computed from file data (#14452)
* Change content-type to be always computed from file data

Restore previous behavior, detecting the content-type isn't very
expensive, and some instances may serve files as application/octet-stream
regardless of their true type, making fetching media from them fail, while
it used to work pre-3.2.0.

* Add test
Diffstat (limited to 'lib')
-rw-r--r--lib/paperclip/response_with_limit_adapter.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/paperclip/response_with_limit_adapter.rb b/lib/paperclip/response_with_limit_adapter.rb
index 7d897b8d6..8711b1349 100644
--- a/lib/paperclip/response_with_limit_adapter.rb
+++ b/lib/paperclip/response_with_limit_adapter.rb
@@ -19,7 +19,7 @@ module Paperclip
       @original_filename = filename_from_content_disposition || filename_from_path || 'data'
       @size = @target.response.content_length
       @tempfile = copy_to_tempfile(@target)
-      @content_type = @target.response.mime_type || ContentTypeDetector.new(@tempfile.path).detect
+      @content_type = ContentTypeDetector.new(@tempfile.path).detect
     end
 
     def copy_to_tempfile(source)