attachments 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/attachments/extract.rb +11 -3
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/attachments/extract.rb
CHANGED
@@ -99,16 +99,24 @@ module Attachments
|
|
99
99
|
filename = "#{@name}.#{uuid}"
|
100
100
|
filepath = "/tmp/#{filename}"
|
101
101
|
|
102
|
+
|
102
103
|
body = case ct
|
103
104
|
when "text/plain" then
|
104
105
|
m = mail.body.decoded
|
106
|
+
if charset && charset.match(/charset=/i)
|
107
|
+
charset.gsub!(/charset=/i, "")
|
108
|
+
charset.strip!
|
109
|
+
else
|
110
|
+
charset = nil
|
111
|
+
end
|
105
112
|
begin
|
113
|
+
if charset
|
114
|
+
m.force_encoding(charset)
|
115
|
+
end
|
106
116
|
m.encode("utf-8")
|
107
117
|
rescue
|
108
118
|
# Ruby 1.8 doesn't know encode
|
109
|
-
if charset
|
110
|
-
charset.gsub!(/charset=/i, "")
|
111
|
-
charset.strip!
|
119
|
+
if charset
|
112
120
|
Iconv.conv("utf-8", charset, m)
|
113
121
|
else
|
114
122
|
m
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attachments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rune Myrland
|