]> git.ipfire.org Git - thirdparty/patchwork.git/commit
parser: Don't crash when From: is list email but has weird mangle format
authorAndrew Donnellan <ajd@linux.ibm.com>
Wed, 15 Apr 2020 09:06:56 +0000 (19:06 +1000)
committerStephen Finucane <stephen@that.guru>
Sat, 18 Apr 2020 11:04:19 +0000 (12:04 +0100)
commit77b8191ae6c0c08565f139da9ff94f5a2f21cc6b
tree6f330c4193c856747cb247cf9026d567b7599c71
parentbf2aee679d185f585844d7afecc4145ff3b5b06f
parser: Don't crash when From: is list email but has weird mangle format

get_original_sender() tries to demangle DMARC-mangled From headers, in
the case where the email's From address is the list address. It knows how
to handle Google Groups and Mailman style mangling, where the original
submitter's name will be turned into e.g. "Andrew Donnellan via
linuxppc-dev".

If an email has the From header set to the list address but has a name that
doesn't include " via ", we'll throw an exception because stripped_name
hasn't been set. Sometimes this is because the list name is seemingly
empty, resulting in a mangled name like "Andrew Donnellan via"
without the space after "via" that we detect. Handle this as well as we can
instead, and add a test.

Fixes: 8279a84238c10 ("parser: Unmangle From: headers that have been mangled for DMARC purposes")
Reported-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit 4698499b9704b29244af4a873efc6c8ae6ca3ff8)
patchwork/parser.py
patchwork/tests/test_parser.py