diff options
-rw-r--r-- | lib/net/imap.rb | 4 | ||||
-rw-r--r-- | test/net/imap/test_imap_response_parser.rb | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 39c6734d3b..3f8794cac0 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -2232,6 +2232,10 @@ module Net else result = response_tagged end + while lookahead.symbol == T_SPACE + # Ignore trailing space for Microsoft Exchange Server + shift_token + end match(T_CRLF) match(T_EOF) return result diff --git a/test/net/imap/test_imap_response_parser.rb b/test/net/imap/test_imap_response_parser.rb index db07f9b022..3ebb248b4e 100644 --- a/test/net/imap/test_imap_response_parser.rb +++ b/test/net/imap/test_imap_response_parser.rb @@ -291,4 +291,17 @@ EOF assert_equal("test.xml", body.parts[1].disposition.param["FILENAME"]) assert_equal(nil, body.parts[1].language) end + + # [Bug #13649] + def test_status + parser = Net::IMAP::ResponseParser.new + response = parser.parse("* STATUS INBOX (UIDNEXT 1 UIDVALIDITY 1234)\r\n") + assert_equal("STATUS", response.name) + assert_equal("INBOX", response.data.mailbox) + assert_equal(1234, response.data.attr["UIDVALIDITY"]) + response = parser.parse("* STATUS INBOX (UIDNEXT 1 UIDVALIDITY 1234) \r\n") + assert_equal("STATUS", response.name) + assert_equal("INBOX", response.data.mailbox) + assert_equal(1234, response.data.attr["UIDVALIDITY"]) + end end |