Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit 24fd060

Browse files
ivanoblomovtute
authored andcommitted
Default to Paperclip::ContentTypeDetector (#2270)
* Add default `content_type_detector` to `UploadedFileAdapter`
1 parent a67f296 commit 24fd060

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/paperclip/io_adapters/uploaded_file_adapter.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def cache_current_values
2424
end
2525

2626
def content_type_detector
27-
self.class.content_type_detector
27+
self.class.content_type_detector || Paperclip::ContentTypeDetector
2828
end
2929

3030
def determine_content_type

spec/paperclip/io_adapters/uploaded_file_adapter_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class UploadedFile < OpenStruct; end
2929
end
3030

3131
it "gets the content type" do
32-
assert_equal "image/x-png-by-browser", @subject.content_type
32+
assert_equal "image/png", @subject.content_type
3333
end
3434

3535
it "gets the file's size" do
@@ -98,7 +98,7 @@ class UploadedFile < OpenStruct; end
9898
end
9999

100100
it "gets the content type" do
101-
assert_equal "image/x-png-by-browser", @subject.content_type
101+
assert_equal "image/png", @subject.content_type
102102
end
103103

104104
it "gets the file's size" do

0 commit comments

Comments
 (0)