diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2020-02-26 12:29:33 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2020-02-26 12:29:33 +0000 |
commit | 0e00cb35b34ffa1be8ef47197ba21244330dbcfc (patch) | |
tree | 7c32614bda0f39b68ff24b131f73e756f630d8cb /synapse | |
parent | Remove unused public room list timeout param (#6179) (diff) | |
parent | add M_TOO_LARGE error code for uploading a too large file (#6151) (diff) | |
download | synapse-0e00cb35b34ffa1be8ef47197ba21244330dbcfc.tar.xz |
add M_TOO_LARGE error code for uploading a too large file (#6151)
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/rest/media/v1/upload_resource.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/rest/media/v1/upload_resource.py b/synapse/rest/media/v1/upload_resource.py index 5d76bbdf68..83d005812d 100644 --- a/synapse/rest/media/v1/upload_resource.py +++ b/synapse/rest/media/v1/upload_resource.py @@ -17,7 +17,7 @@ import logging from twisted.web.server import NOT_DONE_YET -from synapse.api.errors import SynapseError +from synapse.api.errors import Codes, SynapseError from synapse.http.server import ( DirectServeResource, respond_with_json, @@ -56,7 +56,11 @@ class UploadResource(DirectServeResource): if content_length is None: raise SynapseError(msg="Request must specify a Content-Length", code=400) if int(content_length) > self.max_upload_size: - raise SynapseError(msg="Upload request body is too large", code=413) + raise SynapseError( + msg="Upload request body is too large", + code=413, + errcode=Codes.TOO_LARGE, + ) upload_name = parse_string(request, b"filename", encoding=None) if upload_name: |