3 ms·
I went and dug up the original code that caused an issue. Here it is: https://github.com/python/cpython/blob/v2.7.1/Lib/cgi.py#L602-L603 https://github.com/pyt
by lihaoyi 2y ago
I went and dug up the original code that caused an issue. Here it is:
https://github.com/python/cpython/blob/v2.7.1/Lib/cgi.py#L602-L603 https://github.com/python/cpython/blob/v2.7.1/Lib/cgi.py#L60...
Python's std lib `cgi.FieldStorage` object was falsy if it did not define any headers, even if it contained file data.
Thus my conditional trying to check whether a file was being uploaded "if request.field_storage" was going through the False branch when files were being uploaded but only in certain header-free scenarios not covered by automated and manual testing. This resulted in us dropping user data on the floor and losing uploaded files for a very large number of users before we realized and shut it off
The other sibling post contains another example where people may be confused, and Google pulls up others. But this is the concrete case that caused us to send out a hundred thousand apology emails to affected customers after losing their files