Discard an empty upload_name before persisting an uploaded file (#7905)

This commit is contained in:
Will Hunt 2020-09-29 17:15:27 +01:00 committed by GitHub
parent e154f7ccb5
commit c2bdf040aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View file

@ -63,6 +63,10 @@ class UploadResource(DirectServeJsonResource):
msg="Invalid UTF-8 filename parameter: %r" % (upload_name), code=400
)
# If the name is falsey (e.g. an empty byte string) ensure it is None.
else:
upload_name = None
headers = request.requestHeaders
if headers.hasHeader(b"Content-Type"):