1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-20 02:52:11 +00:00

Ignore bad encoding in email addresses when parsing maillog files

local/domain parts of email address should be standard ASCII or
UTF-8. Some email addresses contain extended ASCII, leading to
decode failure by the UTF-8 codec (and thus failure of the
Usage-Report script)

This change allows maillog parsing to continue over lines
containing such addresses
This commit is contained in:
David Lamkin 2021-08-09 10:53:10 +01:00
parent 21ad26e452
commit 2fe239b982

View File

@ -586,7 +586,7 @@ def scan_postfix_submission_line(date, log, collector):
def readline(filename): def readline(filename):
""" A generator that returns the lines of a file """ A generator that returns the lines of a file
""" """
with open(filename) as file: with open(filename, errors='replace') as file:
while True: while True:
line = file.readline() line = file.readline()
if not line: if not line: