[PATCH] parser: Fix parsing of pull request emails with CRLF line endings on Python 2

Andrew Donnellan andrew.donnellan at au1.ibm.com
Tue Jan 9 12:01:18 AEDT 2018


On 09/01/18 11:56, Daniel Axtens wrote:
>> diff --git a/patchwork/parser.py b/patchwork/parser.py
>> index 1568bc4..7c677db 100644
>> --- a/patchwork/parser.py
>> +++ b/patchwork/parser.py
>> @@ -666,9 +666,13 @@ def clean_content(content):
>>       """Remove cruft from the email message.
>>   
>>       Catch signature (-- ) and list footer (_____) cruft.
>> +
>> +    Change to Unix line endings (the Python 3 email module does this for us,
>> +    but not Python 2).
>>       """
>>       sig_re = re.compile(r'^(-- |_+)\n.*', re.S | re.M)
>>       content = sig_re.sub('', content)
>> +    content = content.replace('\r\n', '\n')
> Shouldn't this go before the removal of signatures?

Good point

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the Patchwork mailing list