obf 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/obf/utils.rb +10 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3eb08a3e8bb4fa68e9e15ad947027c620d61289d
|
4
|
+
data.tar.gz: 7df6db4d7ab3f7d887f17ce16384730b4503c400
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e45782603c6b1b07b03627bafa42740e6e2a5cd9a89262187fdc5903128cbaaa59fc3eafaa6d4bd07fea4d6cf83f8f63586b2fc669305cd4d720b9486499b6d
|
7
|
+
data.tar.gz: b7ce1bcbd8c3cecf1f7ccc12222555422cf83d4349741fb87a2f1fb37bea82007ea758e408d236a16a400e9348f7d8e687f8bfc64ee59661f203bc8c0bc04964
|
data/lib/obf/utils.rb
CHANGED
@@ -14,7 +14,11 @@ module OBF::Utils
|
|
14
14
|
type = MIME::Types[content_type]
|
15
15
|
type = type && type[0]
|
16
16
|
extension = ""
|
17
|
-
|
17
|
+
if type.respond_to?(:preferred_extension)
|
18
|
+
extension = ("." + type.preferred_extension) if type.preferred_extension
|
19
|
+
elsif type.respond_to?(:extensions)
|
20
|
+
extension = ("." + type.extensions[0]) if type && type.extensions && type.extensions.length > 0
|
21
|
+
end
|
18
22
|
{
|
19
23
|
'content_type' => content_type,
|
20
24
|
'data' => data,
|
@@ -106,7 +110,11 @@ module OBF::Utils
|
|
106
110
|
end
|
107
111
|
type = MIME::Types[image['content_type']]
|
108
112
|
type = type && type[0]
|
109
|
-
|
113
|
+
if type.respond_to?(:preferred_extension)
|
114
|
+
extension = type && ("." + type.preferred_extension)
|
115
|
+
elsif type.respond_to?(:extensions)
|
116
|
+
extension = type && ("." + type.extensions.first)
|
117
|
+
end
|
110
118
|
file = Tempfile.new(["image_stash", extension.to_s])
|
111
119
|
file.binmode
|
112
120
|
if image['data']
|