mailparser 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mailparser.rb +1 -0
- data/test/test_mailparser.rb +16 -0
- metadata +2 -2
data/lib/mailparser.rb
CHANGED
@@ -407,6 +407,7 @@ module MailParser
|
|
407
407
|
def read_part()
|
408
408
|
return if type != "multipart" or @src.eos?
|
409
409
|
b = @header["content-type"][0].params["boundary"]
|
410
|
+
return unless b
|
410
411
|
re = /(?:\A|\r?\n)--#{Regexp.escape b}(?:|(--))(?:\r?\n|\z)/
|
411
412
|
@src.scan_until(re) or return # skip preamble
|
412
413
|
until @src.eos?
|
data/test/test_mailparser.rb
CHANGED
@@ -783,6 +783,22 @@ EOS
|
|
783
783
|
assert_equal("fuga\n", m.part[1].body)
|
784
784
|
end
|
785
785
|
|
786
|
+
def test_extract_without_boundary_parameter()
|
787
|
+
msg = StringIO.new(<<EOS)
|
788
|
+
From: from@example.com
|
789
|
+
Content-Type: multipart/mixed
|
790
|
+
|
791
|
+
--xxx
|
792
|
+
Content-Type: text/plain
|
793
|
+
|
794
|
+
fuga
|
795
|
+
--xxx--
|
796
|
+
EOS
|
797
|
+
m = MailParser::Message.new(msg)
|
798
|
+
assert_equal [], m.part
|
799
|
+
assert_equal "--xxx\nContent-Type: text/plain\n\nfuga\n--xxx--\n", m.body
|
800
|
+
end
|
801
|
+
|
786
802
|
def test_parse_no_header_delimiter()
|
787
803
|
msg = StringIO.new <<EOS
|
788
804
|
Subject: hoge
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mmapscanner
|