summary refs log tree commit diff
path: root/synapse/rest/media/v1/upload_resource.py
diff options
context:
space:
mode:
authorWill Hunt <will@half-shot.uk>2020-09-29 17:15:27 +0100
committerGitHub <noreply@github.com>2020-09-29 12:15:27 -0400
commitc2bdf040aa93f3b542d1b0e2f6ce57853630ec6f (patch)
tree9f8dfca42da5a706238aae564c27206671bf5fa1 /synapse/rest/media/v1/upload_resource.py
parentDon't check whether a 3pid is allowed to register during password reset (#8414) (diff)
downloadsynapse-c2bdf040aa93f3b542d1b0e2f6ce57853630ec6f.tar.xz
Discard an empty upload_name before persisting an uploaded file (#7905)
Diffstat (limited to 'synapse/rest/media/v1/upload_resource.py')
-rw-r--r--synapse/rest/media/v1/upload_resource.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/rest/media/v1/upload_resource.py b/synapse/rest/media/v1/upload_resource.py
index 3ebf7a68e6..d76f7389e1 100644
--- a/synapse/rest/media/v1/upload_resource.py
+++ b/synapse/rest/media/v1/upload_resource.py
@@ -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"):