Skip to content

Commit f9f928e

Browse files
committed
Remove previous fix - see comments at aquasync#5 (comment)
1 parent 5a86dfa commit f9f928e

File tree

2 files changed

+28
-36
lines changed

2 files changed

+28
-36
lines changed

lib/mapi/property_set.rb

-5
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,6 @@ def body_html
282282
end
283283
end
284284
end
285-
if @body_html && @body_html.respond_to?(:encoding)
286-
@body_html.force_encoding("utf-8")
287-
@body_html = @body_html.valid_encoding? ? @body_html : @body_html.encode("utf-16le", :invalid => :replace, :replace => "").encode("utf-8")
288-
end
289-
@body_html
290285
end
291286
end
292287
end

test/test_msg.rb

+28-31
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,36 @@
99
require 'mapi/convert'
1010

1111
class TestMsg < Test::Unit::TestCase
12-
def test_blammo
13-
Mapi::Msg.open "#{TEST_DIR}/test_Blammo.msg" do |msg|
14-
assert_equal '"TripleNickel" <[email protected]>', msg.from
15-
assert_equal 'BlammoBlammo', msg.subject
16-
assert_equal 0, msg.recipients.length
17-
assert_equal 0, msg.attachments.length
18-
# this is all properties
19-
assert_equal 66, msg.properties.raw.length
20-
# this is unique named properties
21-
assert_equal 48, msg.properties.to_h.length
22-
# test accessing the named property keys - same name but different namespace
23-
assert_equal 'Yippee555', msg.props['Name4', Ole::Types::Clsid.parse('55555555-5555-5555-c000-000000000046')]
24-
assert_equal 'Yippee666', msg.props['Name4', Ole::Types::Clsid.parse('66666666-6666-6666-c000-000000000046')]
25-
end
26-
end
12+
def test_blammo
13+
Mapi::Msg.open "#{TEST_DIR}/test_Blammo.msg" do |msg|
14+
assert_equal '"TripleNickel" <[email protected]>', msg.from
15+
assert_equal 'BlammoBlammo', msg.subject
16+
assert_equal 0, msg.recipients.length
17+
assert_equal 0, msg.attachments.length
18+
# this is all properties
19+
assert_equal 66, msg.properties.raw.length
20+
# this is unique named properties
21+
assert_equal 48, msg.properties.to_h.length
22+
# test accessing the named property keys - same name but different namespace
23+
assert_equal 'Yippee555', msg.props['Name4', Ole::Types::Clsid.parse('55555555-5555-5555-c000-000000000046')]
24+
assert_equal 'Yippee666', msg.props['Name4', Ole::Types::Clsid.parse('66666666-6666-6666-c000-000000000046')]
25+
end
26+
end
2727

2828

29-
def test_rtf_to_html_returns_valid_utf8
30-
msg = Mapi::Msg.open "#{TEST_DIR}/multipart-with-html.msg" do |msg|
31-
assert_equal 1, msg.recipients.length
32-
assert_equal 3, msg.attachments.length
33-
html_part = msg.to_mime.parts[0].parts[1].to_s
34-
if html_part.respond_to?(:encoding)
35-
assert_equal 'UTF-8', html_part.encoding.to_s
36-
assert html_part.valid_encoding?
37-
end
38-
end
39-
end
29+
def test_rendered_string_is_valid_encoding
30+
msg = Mapi::Msg.open "#{TEST_DIR}/multipart-with-html.msg" do |msg|
31+
string_version = msg.to_mime.to_s
32+
if string_version.respond_to?(:valid_encoding?)
33+
assert_equal true, string_version.valid_encoding?
34+
end
35+
end
36+
end
4037

41-
def test_embedded_msg_renders_as_string
42-
msg = Mapi::Msg.open "#{TEST_DIR}/embedded.msg" do |msg|
43-
assert_match "message/rfc822", msg.to_mime.to_s
44-
end
45-
end
38+
def test_embedded_msg_renders_as_string
39+
msg = Mapi::Msg.open "#{TEST_DIR}/embedded.msg" do |msg|
40+
assert_match "message/rfc822", msg.to_mime.to_s
41+
end
42+
end
4643
end
4744

0 commit comments

Comments
 (0)