Delete gmail labels header before adding a new one
This fixes a bug in which a message ended up with multiple gmail labels header (X-Keywords or so). Fix fix it by removing all labels headers before adding the updated one. Signed-off-by: Abdo Roig-Maranges <abdo.roig@gmail.com>
This commit is contained in:
@ -93,6 +93,10 @@ class GmailFolder(IMAPFolder):
|
||||
labels = set()
|
||||
labels = labels - self.ignorelabels
|
||||
labels_str = imaputil.format_labels_string(self.labelsheader, sorted(labels))
|
||||
|
||||
# First remove old label headers that may be in the message content retrieved
|
||||
# from gmail Then add a labels header with current gmail labels.
|
||||
body = self.deletemessageheaders(body, self.labelsheader)
|
||||
body = self.addmessageheader(body, '\n', self.labelsheader, labels_str)
|
||||
|
||||
if len(body)>200:
|
||||
|
Reference in New Issue
Block a user