1
0
Fork 0
mirror of https://git.code.sf.net/p/archivemail/code synced 2024-12-23 00:06:43 +00:00

Made From_ mangling work reliably with large messages, too.

This commit is contained in:
Nikolaus Schulz 2006-10-12 19:28:30 +00:00
parent 88ef628f20
commit 6198341eef

View file

@ -335,8 +335,13 @@ class Mbox(mailbox.UnixMailbox):
# The following while loop is about twice as fast in
# practice to 'self.mbox_file.writelines(msg.fp.readlines())'
assert(options.read_buffer_size > 0)
linebuf = ""
while 1:
body = msg.fp.read(options.read_buffer_size)
chunk = msg.fp.read(options.read_buffer_size)
# Be careful not to break pattern matching
splitindex = chunk.rfind(os.linesep)
body = linebuf + chunk[:splitindex]
linebuf = chunk[splitindex:]
if not body:
break
body = from_re.sub('>From ', body)