Skip to content

Commit

Permalink
Merge pull request #175 from mtrbean/patch-1
Browse files Browse the repository at this point in the history
handle last boundary without CRLF
  • Loading branch information
sigmavirus24 committed Feb 10, 2017
2 parents 2458640 + ea6d7e3 commit 7575b60
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion requests_toolbelt/multipart/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ def body_part(part):
return BodyPart(fixed, self.encoding)

def test_part(part):
return part != b'' and part != b'\r\n' and part[:4] != b'--\r\n'
return (part != b'' and
part != b'\r\n' and
part[:4] != b'--\r\n' and
part != b'--')

parts = self.content.split(b''.join((b'\r\n', boundary)))
self.parts = tuple(body_part(x) for x in parts if test_part(x))
Expand Down

0 comments on commit 7575b60

Please sign in to comment.