don't try to copy messages with UID == 0
Output a warning so that we can dig into this. For now, the patch doesn't fix the root cause. If the server returns UID 0 as valid UID number, this must be ignored as soon as possible. Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/336 Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
9a7603af37
commit
65d4c94f07
@ -857,7 +857,7 @@ class BaseFolder(object):
|
|||||||
1) Look for messages present in self but not in statusfolder.
|
1) Look for messages present in self but not in statusfolder.
|
||||||
2) invoke copymessageto() on those which:
|
2) invoke copymessageto() on those which:
|
||||||
- If dstfolder doesn't have it yet, add them to dstfolder.
|
- If dstfolder doesn't have it yet, add them to dstfolder.
|
||||||
- Update statusfolder
|
- Update statusfolder.
|
||||||
|
|
||||||
This function checks and protects us from action in dryrun mode."""
|
This function checks and protects us from action in dryrun mode."""
|
||||||
|
|
||||||
@ -866,16 +866,26 @@ class BaseFolder(object):
|
|||||||
|
|
||||||
threads = []
|
threads = []
|
||||||
|
|
||||||
copylist = [uid for uid in self.getmessageuidlist() if not statusfolder.uidexists(uid)]
|
copylist = [uid for uid in self.getmessageuidlist()
|
||||||
|
if not statusfolder.uidexists(uid)]
|
||||||
num_to_copy = len(copylist)
|
num_to_copy = len(copylist)
|
||||||
if num_to_copy and self.repository.account.dryrun:
|
|
||||||
self.ui.info("[DRYRUN] Copy {0} messages from {1}[{2}] to {3}".format(
|
if num_to_copy > 0 and self.repository.account.dryrun:
|
||||||
num_to_copy, self, self.repository, dstfolder.repository))
|
self.ui.info(
|
||||||
|
"[DRYRUN] Copy {0} messages from {1}[{2}] to {3}".format(
|
||||||
|
num_to_copy, self, self.repository, dstfolder.repository)
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
for num, uid in enumerate(copylist):
|
for num, uid in enumerate(copylist):
|
||||||
# Bail out on CTRL-C or SIGTERM.
|
# Bail out on CTRL-C or SIGTERM.
|
||||||
if offlineimap.accounts.Account.abort_NOW_signal.is_set():
|
if offlineimap.accounts.Account.abort_NOW_signal.is_set():
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if uid == 0:
|
||||||
|
self.ui.warn("Assertion that UID != 0 failed; ignoring message.")
|
||||||
|
continue
|
||||||
|
|
||||||
if uid > 0 and dstfolder.uidexists(uid):
|
if uid > 0 and dstfolder.uidexists(uid):
|
||||||
# dstfolder has message with that UID already, only update status.
|
# dstfolder has message with that UID already, only update status.
|
||||||
flags = self.getmessageflags(uid)
|
flags = self.getmessageflags(uid)
|
||||||
|
Loading…
Reference in New Issue
Block a user