Commit 406a29b
committed
Fix absent file uploads with Python 3.
If a form has a file upload input control for a Link to a FileClass
class, but no file is uploaded, browsers submit this as an upload with
empty filename and file contents. This then goes through the Roundup
code:
# value might be a single file upload
if not getattr(value, 'filename', None):
value = value.value.strip()
which results in value holding those empty file contents.
With Python 2, the code
elif value == '':
# other types should be None'd if there's no value
value = None
then results in value being set to None, meaning no file node gets
created. With Python 3, however, value is b'' at this point and so
the code ends up creating a file node with empty content. Thus, this
patch fixes this by also checking for b'' there.1 parent e7a4152 commit 406a29b
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
472 | | - | |
| 472 | + | |
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
| |||
0 commit comments