mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Fix for SF bug #1072623. When the last line of the input string does not end
in a newline, and it's an end boundary, the FeedParser wasn't recognizing it as such. Tweak the regexp to make the ending linesep optional. For grins, clear self._partial when closing the BufferedSubFile. Added a test case.
This commit is contained in:
parent
f7f9b6cb2d
commit
2e8c1f189a
2 changed files with 16 additions and 1 deletions
|
@ -1351,6 +1351,20 @@ Content-Type: text/plain
|
|||
eq(msg.get_boundary(), ' XXXX')
|
||||
eq(len(msg.get_payload()), 2)
|
||||
|
||||
def test_boundary_without_trailing_newline(self):
|
||||
m = Parser().parsestr("""\
|
||||
Content-Type: multipart/mixed; boundary="===============0012394164=="
|
||||
MIME-Version: 1.0
|
||||
|
||||
--===============0012394164==
|
||||
Content-Type: image/file1.jpg
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: base64
|
||||
|
||||
YXNkZg==
|
||||
--===============0012394164==--""")
|
||||
self.assertEquals(m.get_payload(0).get_payload(), 'YXNkZg==')
|
||||
|
||||
|
||||
|
||||
# Test some badly formatted messages
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue