engine: Fix flag being mistaken for a response code
The parser would think the flag was a response code if the flag started with a '[' character. Flags like these are sometimes returned by Gmail which broke fetching emails from Gmail. This commit checks if the parser is already parsing flags and if so treats any starting '[' characters as part of the flag string.
This commit is contained in:
parent
14bb81f93f
commit
efca9615a6
2 changed files with 7 additions and 1 deletions
|
|
@ -562,6 +562,12 @@ public class Geary.Imap.Deserializer : BaseObject, Logging.Source {
|
|||
char ch = *((char *) user);
|
||||
switch (ch) {
|
||||
case '[':
|
||||
// "[" is a valid character for flags (and used by Gmail)
|
||||
if (this.is_parsing_flags) {
|
||||
append_to_string(ch);
|
||||
return State.FLAG;
|
||||
}
|
||||
|
||||
// open response code
|
||||
ResponseCode response_code = new ResponseCode();
|
||||
push(response_code);
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ class Geary.Imap.DeserializerTest : TestCase {
|
|||
public void gmail_broken_flags() throws GLib.Error {
|
||||
// As of 2020-05-01, GMail does not correctly quote email
|
||||
// flags. See #746
|
||||
string flags = """* FLAGS (\Answered \Flagged \Draft \Deleted \Seen $Forwarded $MDNSent $NotPhishing $Phishing Junk LoadRemoteImages NonJunk OIB-Seen-INBOX OIB-Seen-Unsubscribe OIB-Seen-[Gmail]/Important OIB-Seen-[Gmail]/Spam OIB-Seen-[Gmail]/Tous les messages)""";
|
||||
string flags = """* FLAGS (\Answered \Flagged \Draft \Deleted \Seen $Forwarded $MDNSent $NotPhishing $Phishing Junk LoadRemoteImages NonJunk OIB-Seen-INBOX OIB-Seen-Unsubscribe [GMail]/Sent_Mail OIB-Seen-[Gmail]/Important OIB-Seen-[Gmail]/Spam OIB-Seen-[Gmail]/Tous les messages)""";
|
||||
this.stream.add_data(flags.data);
|
||||
this.stream.add_data(EOL.data);
|
||||
this.deser.quirks = new Imap.Quirks();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue