diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-12-04 10:26:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-04 10:26:09 -0500 |
commit | df3e6a23a74e85005881bd5bead3443f4f758095 (patch) | |
tree | 3fde5063616152cc626e81a1f5bd9ed85aa34099 /synapse | |
parent | Merge tag 'v1.24.0rc2' into develop (diff) | |
download | synapse-df3e6a23a74e85005881bd5bead3443f4f758095.tar.xz |
Do not 500 if the content-length is not provided when uploading media. (#8862)
Instead return the proper 400 error.
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/rest/media/v1/upload_resource.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/synapse/rest/media/v1/upload_resource.py b/synapse/rest/media/v1/upload_resource.py index d76f7389e1..42febc9afc 100644 --- a/synapse/rest/media/v1/upload_resource.py +++ b/synapse/rest/media/v1/upload_resource.py @@ -44,7 +44,7 @@ class UploadResource(DirectServeJsonResource): requester = await self.auth.get_user_by_req(request) # TODO: The checks here are a bit late. The content will have # already been uploaded to a tmp file at this point - content_length = request.getHeader(b"Content-Length").decode("ascii") + content_length = request.getHeader("Content-Length") if content_length is None: raise SynapseError(msg="Request must specify a Content-Length", code=400) if int(content_length) > self.max_upload_size: |