Skip to content

Commit

Permalink
Import Pull-Request #226 (Fix issue #224)
Browse files Browse the repository at this point in the history
  • Loading branch information
azumakuniyuki committed Sep 29, 2021
1 parent e3718d4 commit b25d4be
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/sisimai/rfc2045.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def decodeB(argv0 = nil)

p = nil
if cv = argv0.match(%r|([+/\=0-9A-Za-z\r\n]+)|) then p = Base64.decode64(cv[1]) end
return p ? p.force_encoding('UTF-8') : nil
return p ? p.scrub('?') : nil
end

# Decode MIME Quoted-Printable Encoded string
Expand Down
34 changes: 34 additions & 0 deletions set-of-emails/maildir/bsd/rfc3464-42.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From MAILER-DAEMON Mon Sep 20 19:33:02 2021
Return-Path: <>
X-Original-To: postmaster@blackhole.our-host.net
Delivered-To: blackhole@localhost
Received: from mx2.itnetwork.net (mx2.itnetwork.net [123.123.123.202])
by play.thmthlayer.com (Postfix) with ESMTPS id 94598E117B
for <postmaster@blackhole.our-host.net>; Mon, 20 Sep 2021 19:33:02 +0000 (UTC)
Received: from 10.9.37.234 ([10.9.34.13]) by mx2.itnetwork.net with ESMTP id rTR3cr9xLoMiR5vX for <postmaster@blackhole.our-host.net>; Mon, 20 Sep 2021 21:33:01 +0200 (CEST)
Date: Mon, 20 Sep 2021 21:32:59 +0200 (GMT+02:00)
From: Postmaster@bit-onbreeeck.org
To: MyName <message@gelaneeiuet.org>
Subject: foobar
Mime-Version: 1.0
Message-ID: <OFB3228DED.DDDCAC8E-ONC1258756.006B648D-C1258756.006B6493@bit-onbreeeck.org>
Content-Type: multipart/report; report-type=delivery-status; boundary="==IFJRGLKFGIR7891042UHRUHIHD"

--==IFJRGLKFGIR7891042UHRUHIHD
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: base64
ICBhdWZnZWb8aHJ0DQoNCg==
--==IFJRGLKFGIR7891042UHRUHIHD
Content-Type: message/delivery-status
Reporting-MTA: dns;10.9.37.234
Final-Recipient: rfc822;jane.doe@some-domain.net
Action: failed
Status: 5.0.0
Diagnostic-Code: The email account that you tried to reach does not exist.
--==IFJRGLKFGIR7891042UHRUHIHD--

4 changes: 2 additions & 2 deletions test/public/mail-maildir-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class MailMaildirTest < Minitest::Test
Methods = { class: %w[new], object: %w[path dir file size handle offset read] }
Samples = ['./set-of-emails/maildir/bsd', './set-of-emails/maildir/mac']
Maildir = Sisimai::Mail::Maildir.new(Samples[0])
DirSize = 503
DirSize = 507

def test_methods
Methods[:class].each { |e| assert_respond_to Sisimai::Mail::Maildir, e }
Expand Down Expand Up @@ -54,7 +54,7 @@ def test_file
def test_size
assert_instance_of Integer, Maildir.size
assert_equal true, Maildir.size > 0
assert_equal 505, Maildir.size
assert_equal DirSize, Maildir.size

ce = assert_raises ArgumentError do
Maildir.size(nil)
Expand Down
2 changes: 1 addition & 1 deletion test/public/rfc2045-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_decodeB
# decocdeB returns the original string when it is not encoded text
assert_nil Sisimai::RFC2045.decodeB(nil)
assert_nil Sisimai::RFC2045.decodeB(Pt7)
assert_equal Pt7, Sisimai::RFC2045.decodeB(Be7)
assert_equal Pt7, Sisimai::RFC2045.decodeB(Be7).force_encoding('UTF-8')

ce = assert_raises ArgumentError do
Sisimai::RFC2045.decodeB()
Expand Down
1 change: 1 addition & 0 deletions test/public/rfc3464.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module RFC3464
'39' => [['5.0.901', '', 'onhold', false]],
'40' => [['4.4.6', '', 'networkerror', false]],
'41' => [['5.0.901', '', 'onhold', false]],
'42' => [['5.0.0', '', 'filtered', false]],
}
end
end
Expand Down

0 comments on commit b25d4be

Please sign in to comment.