1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-25 02:47:04 +00:00

Ignore bad encoding in email addresses when parsing maillog files (#2017)

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:
lamkin 2021-08-16 16:46:32 +01:00 committed by GitHub
parent 21ad26e452
commit daad122236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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: