Bug report
Bug description:
Issue
email.quoprimime.decode() strips only one character when removing a trailing line ending that wasn't in the original input. When eol='\r\n' (2 characters), only the \n is removed, leaving a stray \r.
The bug is in this line:
It should be decoded[:-len(eol)].
Reproducer
import email.quoprimime as qp
print(repr(qp.decode('abc', eol='\r\n'))) # 'abc\r' — expected 'abc'
print(repr(qp.decode('a\nb', eol='\r\n'))) # 'a\r\nb\r' — trailing \r is spurious
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Bug report
Bug description:
Issue
email.quoprimime.decode()strips only one character when removing a trailing line ending that wasn't in the original input. Wheneol='\r\n'(2 characters), only the\nis removed, leaving a stray\r.The bug is in this line:
It should be
decoded[:-len(eol)].Reproducer
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
decode()leaves stray\rwheneol='\r\n'#145832decode()leaves stray\rwheneol='\r\n'(GH-145832) #148311decode()leaves stray\rwheneol='\r\n'(GH-145832) #148312