Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* #868 - Use the Ruby19.charset_encoder when decoding message bodies (kjg)
* #866 - Support decoding message bodies with non-Ruby-standard charsets (jeremy)
* #907 - Mail::ContentDispositionField should work with nil value (kjg)
* #719 - Fix for when header content looks like field name (kjg)

== Version 2.6.3 - Mon Nov 3 23:53 +1100 2014 Mikel Lindsaar <mikel@reinteractive.net>

Expand Down
2 changes: 1 addition & 1 deletion lib/mail/fields/common/common_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def strip_field(field_name, value)
if value.is_a?(Array)
value
else
value.to_s.sub(/#{field_name}:\s+/i, EMPTY)
value.to_s.sub(/\A#{field_name}:\s+/i, EMPTY)
end
end

Expand Down
17 changes: 13 additions & 4 deletions spec/mail/fields/common/common_field_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,20 @@
expect(field.encoded).to eq result
expect(field.decoded).to eq value
end


end

context "when including the field name" do
it "does not strip out content that looks identitcal to the field name" do
field = Mail::SubjectField.new("Subject: Subject: for your approval")
expect(field.decoded).to eq("Subject: for your approval")
end
end

it "does not strip out content that looks identitcal to the field name" do
field = Mail::SubjectField.new("Subject: Subject: for your approval")
expect(field.decoded).to eq("Subject: for your approval")
context "when not including the field name" do
it "does not strip out content that looks identitcal to the field name" do
field = Mail::SubjectField.new("This is an important subject: here")
expect(field.decoded).to eq("This is an important subject: here")
end
end
end