From d3c40cda7aed640603a26f00817e980aacfc244e Mon Sep 17 00:00:00 2001 From: nicholas evans Date: Fri, 17 Nov 2023 11:23:40 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Document=20and=20test=20workaround?= =?UTF-8?q?=20for=20#228?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The workaround for #241 (PR #246) also applies to #228. The upstream issue (greenmail-mail-test/greenmail#633) was fixed promptly (thanks!). Also, greenmail is a testing fake server and I haven't seen any evidence of any "real" servers with this exact error yet. So I don't feel that it's critical to be compatible with it... But we _do_ need this workaround for #241. So it makes sense to at least document this issue in our test fixtures, for posterity. --- lib/net/imap/response_parser.rb | 2 ++ .../response_parser/quirky_behaviors.yml | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/net/imap/response_parser.rb b/lib/net/imap/response_parser.rb index 5bd672f4..1aab798f 100644 --- a/lib/net/imap/response_parser.rb +++ b/lib/net/imap/response_parser.rb @@ -1929,6 +1929,8 @@ def flag_perm__list end end + # This allows illegal "]" in flag names (Gmail), + # or "\*" in a FLAGS response (greenmail). def quirky__flag_list(name) match_re(Patterns::QUIRKY_FLAGS_LIST, "quirks mode #{name}")[1] .scan(Patterns::QUIRKY_FLAG) diff --git a/test/net/imap/fixtures/response_parser/quirky_behaviors.yml b/test/net/imap/fixtures/response_parser/quirky_behaviors.yml index 8a7c0b2a..2b72c5cb 100644 --- a/test/net/imap/fixtures/response_parser/quirky_behaviors.yml +++ b/test/net/imap/fixtures/response_parser/quirky_behaviors.yml @@ -138,3 +138,21 @@ $Junk $MailFlagBit0 $MailFlagBit2 $NotJunk $NotPhishing $Phishing Forwarded JunkRecorded NotJunk OIB-Seen-INBOX OIB-Seen-Unsubscribe OIB-Seen-[Google Mail]/Alle Nachrichten)\r\n" + + "greenmail sent \"\\*\" in a FLAGS response": + comment: | + Greenmail did fix theit bug very quickly after it was reported. :) + Upstream issue: https://github.com/greenmail-mail-test/greenmail/issues/633 + net-imap issue: https://github.com/ruby/net-imap/issues/228 + :response: "* FLAGS (\\Answered \\Deleted \\Draft \\Flagged \\Seen \\*)\r\n" + expect_rescued_error: true + :expected: !ruby/struct:Net::IMAP::UntaggedResponse + name: FLAGS + data: + - :Answered + - :Deleted + - :Draft + - :Flagged + - :Seen + - :* + raw_data: "* FLAGS (\\Answered \\Deleted \\Draft \\Flagged \\Seen \\*)\r\n"