summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2004-05-10 14:48:30 (GMT)
committerBarry Warsaw <barry@python.org>2004-05-10 14:48:30 (GMT)
commitc29db265296b3c31b1f102fced2773ed468ab639 (patch)
tree5fd273f2ace451ff214f966485f768cfb16024b1 /Lib/email
parent6f3b033774c9e6b005a18bcf6811f138b61b92e8 (diff)
downloadcpython-c29db265296b3c31b1f102fced2773ed468ab639.zip
cpython-c29db265296b3c31b1f102fced2773ed468ab639.tar.gz
cpython-c29db265296b3c31b1f102fced2773ed468ab639.tar.bz2
_parse_headers(): Strip a trailing newline from the envelope header. Closes
SF #951088.
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/FeedParser.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/email/FeedParser.py b/Lib/email/FeedParser.py
index 0bb9271..806277f 100644
--- a/Lib/email/FeedParser.py
+++ b/Lib/email/FeedParser.py
@@ -404,6 +404,10 @@ class FeedParser:
# Check for envelope header, i.e. unix-from
if line.startswith('From '):
if lineno == 0:
+ # Strip off the trailing newline
+ mo = NLCRE_eol.search(line)
+ if mo:
+ line = line[:-len(mo.group(0))]
self._cur.set_unixfrom(line)
continue
elif lineno == len(lines) - 1: