Skip to content

Commit 87e3305

Browse files
committed
✅ Document and test workaround for #228
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.
1 parent 401cb26 commit 87e3305

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

lib/net/imap/response_parser.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,6 +1929,8 @@ def flag_perm__list
19291929
end
19301930
end
19311931

1932+
# This allows illegal "]" in flag names (Gmail),
1933+
# or "\*" in a FLAGS response (greenmail).
19321934
def quirky__flag_list(name)
19331935
match_re(Patterns::QUIRKY_FLAGS_LIST, "quirks mode #{name}")[1]
19341936
.scan(Patterns::QUIRKY_FLAG)

test/net/imap/fixtures/response_parser/quirky_behaviors.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,27 @@
138138
$Junk $MailFlagBit0 $MailFlagBit2 $NotJunk $NotPhishing $Phishing Forwarded
139139
JunkRecorded NotJunk OIB-Seen-INBOX OIB-Seen-Unsubscribe OIB-Seen-[Google
140140
Mail]/Alle Nachrichten)\r\n"
141+
142+
"greenmail sent \"\\*\" in a FLAGS response":
143+
comment: |
144+
net-imap issue: https://github.com/ruby/net-imap/issues/228
145+
146+
Greenmail did fix their bug very quickly after it was reported. :)
147+
Upstream issue: https://github.com/greenmail-mail-test/greenmail/issues/633
148+
149+
Also, greenmail is a testing fake server and I haven't seen any evidence
150+
of any "real" servers with this exact error yet. So I don't feel that it's
151+
critical to be compatible with it. But, since we needed the workaround
152+
anyway, for #241, it's reasonable to document that it handles this too.
153+
:response: "* FLAGS (\\Answered \\Deleted \\Draft \\Flagged \\Seen \\*)\r\n"
154+
expect_rescued_error: true
155+
:expected: !ruby/struct:Net::IMAP::UntaggedResponse
156+
name: FLAGS
157+
data:
158+
- :Answered
159+
- :Deleted
160+
- :Draft
161+
- :Flagged
162+
- :Seen
163+
- :*
164+
raw_data: "* FLAGS (\\Answered \\Deleted \\Draft \\Flagged \\Seen \\*)\r\n"

0 commit comments

Comments
 (0)