paperclip-hacked 2.3.1.2 → 2.3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/paperclip/upfile.rb +9 -1
- metadata +2 -2
data/lib/paperclip/upfile.rb
CHANGED
@@ -6,7 +6,7 @@ module Paperclip
|
|
6
6
|
|
7
7
|
# Infer the MIME-type of the file from the extension.
|
8
8
|
def content_type
|
9
|
-
type = (self.path.match(/\.(\w+)$/)[1] rescue
|
9
|
+
type = (self.path.match(/\.(\w+)$/)[1] rescue mime_type_fuee).downcase
|
10
10
|
case type
|
11
11
|
when %r"jp(e|g|eg)" then "image/jpeg"
|
12
12
|
when %r"tiff?" then "image/tiff"
|
@@ -29,6 +29,14 @@ module Paperclip
|
|
29
29
|
def size
|
30
30
|
File.size(self)
|
31
31
|
end
|
32
|
+
|
33
|
+
def mime_type_fuee
|
34
|
+
if File.respond_to?(:mime_type?)
|
35
|
+
File.mime_type?(self)
|
36
|
+
else
|
37
|
+
"octet-stream"
|
38
|
+
end
|
39
|
+
end
|
32
40
|
end
|
33
41
|
end
|
34
42
|
|