File tree Expand file tree Collapse file tree 4 files changed +16
-2
lines changed
lib/mail/version_specific Expand file tree Collapse file tree 4 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
1
== HEAD
2
2
3
+ * Fix failing spec Issue 453 on Ruby 1.9.3
4
+
3
5
== Version 2.4.4 - Wed Mar 14 22:44:00 +1100 2012 Mikel Lindsaar <mikel@reinteractive.net>
4
6
5
7
* Fix security vulnerability allowing command line exploit when using file delivery method
Original file line number Diff line number Diff line change @@ -80,7 +80,10 @@ def Ruby18.q_value_decode(str)
80
80
match = str . match ( /\= \? (.+)?\? [Qq]\? (.+)?\? \= /m )
81
81
if match
82
82
encoding = match [ 1 ]
83
- str = Encodings ::QuotedPrintable . decode ( match [ 2 ] . gsub ( /_/ , '=20' ) )
83
+ string = match [ 2 ] . gsub ( /_/ , '=20' )
84
+ # Remove trailing = if it exists in a Q encoding
85
+ string = string . sub ( /\= $/ , '' )
86
+ str = Encodings ::QuotedPrintable . decode ( string )
84
87
end
85
88
str
86
89
end
Original file line number Diff line number Diff line change @@ -68,7 +68,10 @@ def Ruby19.q_value_decode(str)
68
68
match = str . match ( /\= \? (.+)?\? [Qq]\? (.+)?\? \= /m )
69
69
if match
70
70
encoding = match [ 1 ]
71
- str = Encodings ::QuotedPrintable . decode ( match [ 2 ] . gsub ( /_/ , '=20' ) )
71
+ string = match [ 2 ] . gsub ( /_/ , '=20' )
72
+ # Remove trailing = if it exists in a Q encoding
73
+ string = string . sub ( /\= $/ , '' )
74
+ str = Encodings ::QuotedPrintable . decode ( string )
72
75
str . force_encoding ( fix_encoding ( encoding ) )
73
76
end
74
77
decoded = str . encode ( "utf-8" , :invalid => :replace , :replace => "" )
Original file line number Diff line number Diff line change 609
609
b . should eq expected
610
610
end
611
611
612
+ it "should unquote Shift_JIS QP with trailing =" do
613
+ a = "=?Shift_JIS?Q?=93=FA=96{=8C=EA=?="
614
+ b = Mail ::Encodings . unquote_and_convert_to ( a , 'utf-8' )
615
+ b . should eq "日本語"
616
+ end
617
+
612
618
it "should unquote multiple strings in the middle of the text" do
613
619
a = "=?Shift_JIS?Q?=93=FA=96{=8C=EA=?= <a@example.com>, =?Shift_JIS?Q?=93=FA=96{=8C=EA=?= <b@example.com>"
614
620
b = Mail ::Encodings . unquote_and_convert_to ( a , 'utf-8' )
You can’t perform that action at this time.
0 commit comments