]> granicus.if.org Git - python/commitdiff
_parse_headers(): Strip a trailing newline from the envelope header. Closes
authorBarry Warsaw <barry@python.org>
Mon, 10 May 2004 14:48:30 +0000 (14:48 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 10 May 2004 14:48:30 +0000 (14:48 +0000)
SF #951088.

Lib/email/FeedParser.py

index 0bb92712aee4c6f3163a7d13aaf15bbe7aca4577..806277f08210dff88f2cba6cc8afd801a66d5dfb 100644 (file)
@@ -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: