Author X-Istence
Recipients Decorater, X-Istence, rr-, vstinner
Date 2016-09-27.03:40:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1474947602.79.0.570413647775.issue27777@psf.upfronthosting.co.za>
In-reply-to
Content
On line #890 in self.make_file() the check for _binary_file should be changed to also check for self.length >= 0.

https://github.com/python/cpython/blob/3.4/Lib/cgi.py#L890

becomes:

if self._binary_file or self.length >= 0:

_binary_file is only ever set if there is a content disposition, which there is not in the test case provided. In the case of no content disposition we can use the content-length as a hint that we have a file that has been uploaded. All files uploaded should be treated as binary if they are not a text type.

This is a duplicate of #27308, however the patch in that report is incorrect IMHO.
History
Date User Action Args
2016-09-27 03:40:02X-Istencesetrecipients: + X-Istence, vstinner, Decorater, rr-
2016-09-27 03:40:02X-Istencesetmessageid: <1474947602.79.0.570413647775.issue27777@psf.upfronthosting.co.za>
2016-09-27 03:40:02X-Istencelinkissue27777 messages
2016-09-27 03:40:02X-Istencecreate