mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-07 20:52:11 -04:00
Do not 500 if the content-length is not provided when uploading media. (#8862)
Instead return the proper 400 error.
This commit is contained in:
parent
112f6bd49e
commit
df3e6a23a7
2 changed files with 2 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue