Open tiehexue opened 2 months ago
thunderbird, apple mail, just works fine with such mailbox.
https://www.rfc-editor.org/rfc/rfc3501#section-9:
address = "(" addr-name SP addr-adl SP addr-mailbox SP
addr-host ")"
addr-name = nstring
; If non-NIL, holds phrase from [[RFC-2822](https://www.rfc-editor.org/rfc/rfc2822)]
; mailbox after removing [[RFC-2822](https://www.rfc-editor.org/rfc/rfc2822)] quoting
literal = "{" number "}" CRLF *CHAR8
; Number represents the number of CHAR8s
nstring = string / nil
quoted = DQUOTE *QUOTED-CHAR DQUOTE
QUOTED-CHAR = <any TEXT-CHAR except quoted-specials> /
"\" quoted-specials
quoted-specials = DQUOTE / "\"
string = quoted / literal
As such, per the spec you should be escaping your quotes.
Extra quotes should be added through somehow in a long email thread across different mail clients and servers. I am not able to eliminate that before I saw it. Should I escape it before send to this library?
汪院
发件人: Dirkjan Ochtman @.> 发送时间: Monday, May 27, 2024 5:36:20 PM 收件人: djc/tokio-imap @.> 抄送: tiehexue @.>; Author @.> 主题: Re: [djc/tokio-imap] mailbox parser error (Issue #171)
https://www.rfc-editor.org/rfc/rfc3501#section-9:
address = "(" addr-name SP addr-adl SP addr-mailbox SP
addr-host ")"
addr-name = nstring
; If non-NIL, holds phrase from [RFC-2822]
; mailbox after removing [RFC-2822] quoting
literal = "{" number "}" CRLF CHAR8
; Number represents the number of CHAR8s
nstring = string / nil
quoted = DQUOTE QUOTED-CHAR DQUOTE
QUOTED-CHAR =
As such, per the spec you should be escaping your quotes.
― Reply to this email directly, view it on GitHubhttps://github.com/djc/tokio-imap/issues/171#issuecomment-2133075822, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAHIYCKCJIXODG6DPFWNOFLZEL5BJAVCNFSM6AAAAABIKMRXCKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZTGA3TKOBSGI. You are receiving this because you authored the thread.Message ID: @.***>
Extra quotes should be added through somehow in a long email thread across different mail clients and servers. I am not able to eliminate that before I saw it. Should I escape it before send to this library? 汪院
I'm open to reviewing a PR that makes the parser more robust on this front, but whether I'll want to merge it depends on the complexity.
I am trying to build a client app based on himalaya(https://github.com/soywod/himalaya), which used imap-proto 0.16.3. It crashes when parsing a mailbox with quotes, e.g. ((“name_in_base64”extraname(extrahost)”” nil “wangyuan” “host.com”)). Any advices how to fix