From 8e73e315e4a77dbccd8bfa3f1c049e279b581eb1 Mon Sep 17 00:00:00 2001 From: Nikolaus Schulz Date: Wed, 24 Oct 2007 02:23:59 +0000 Subject: Skip invalid messages/files in Maildirs. Closes: #1783369, Debian bug #255944, and Debian bug #305902 also seems about this issue. --- archivemail.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/archivemail.py b/archivemail.py index b3f6a00..4822a32 100755 --- a/archivemail.py +++ b/archivemail.py @@ -1264,8 +1264,10 @@ def _archive_dir(mailbox_name, final_archive_name, type): cache = IdentityCache(mailbox_name) - msg = original.next() - while (msg): + for msg in original: + if not msg: + vprint("ignoring invalid message '%s'" % get_filename(msg)) + continue msg_size = sizeof_message(msg) stats.another_message(msg_size) vprint("processing message '%s'" % msg.get('Message-ID')) @@ -1286,7 +1288,6 @@ def _archive_dir(mailbox_name, final_archive_name, type): if not options.dry_run: delete_queue.append(get_filename(msg)) else: vprint("decision: retain message") - msg = original.next() vprint("finished reading messages") if not options.dry_run: if archive: -- cgit v1.2.3