tmail 1.2.6 → 1.2.7
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/lib/tmail/attachments.rb +1 -1
- data/lib/tmail/quoting.rb +10 -1
- data/lib/tmail/version.rb +1 -1
- data/test/test_attachments.rb +3 -1
- data/tmail.gemspec +1 -1
- metadata +1 -1
data/lib/tmail/attachments.rb
CHANGED
data/lib/tmail/quoting.rb
CHANGED
@@ -60,8 +60,17 @@ module TMail
|
|
60
60
|
|
61
61
|
include TextUtils
|
62
62
|
|
63
|
+
def quoted?(string)
|
64
|
+
!!((string =~ /.+'\w\w'.+/) || (string =~ /=\?.+\?.\?.+\?=/))
|
65
|
+
end
|
66
|
+
|
67
|
+
# Only unquote if quoted
|
63
68
|
def original_filename(to_charset = 'utf-8')
|
64
|
-
|
69
|
+
if quoted?(quoted_filename)
|
70
|
+
Unquoter.unquote_and_convert_to(quoted_filename, to_charset).chomp
|
71
|
+
else
|
72
|
+
quoted_filename
|
73
|
+
end
|
65
74
|
end
|
66
75
|
end
|
67
76
|
|
data/lib/tmail/version.rb
CHANGED
data/test/test_attachments.rb
CHANGED
@@ -44,7 +44,9 @@ HERE
|
|
44
44
|
fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email8")
|
45
45
|
mail = TMail::Mail.parse(fixture)
|
46
46
|
attachment = mail.attachments.last
|
47
|
-
|
47
|
+
expected = "01 Quien Te Dij\212at. Pitbull.mp3"
|
48
|
+
expected.force_encoding(Encoding::ASCII_8BIT) if expected.respond_to?(:force_encoding)
|
49
|
+
assert_equal expected, attachment.original_filename
|
48
50
|
end
|
49
51
|
|
50
52
|
def test_attachment_with_quoted_filename
|
data/tmail.gemspec
CHANGED