-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
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:
decoded = decoded[:-1]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 spuriousCPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error