summary refs log tree commit diff
path: root/synapse/rest/media/v1/upload_resource.py
diff options
context:
space:
mode:
authorAnshul Angaria <angaria.anshul38@gmail.com>2019-10-08 18:25:16 +0530
committerAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2019-10-08 13:55:16 +0100
commit474abf1eb6852ca488fbf86d3da0622a457efef1 (patch)
tree3e65e7a8a78e4f62006cb198909ff78aedf15815 /synapse/rest/media/v1/upload_resource.py
parentRemove unused public room list timeout param (#6179) (diff)
downloadsynapse-474abf1eb6852ca488fbf86d3da0622a457efef1.tar.xz
add M_TOO_LARGE error code for uploading a too large file (#6151)
Fixes #6109
Diffstat (limited to 'synapse/rest/media/v1/upload_resource.py')
-rw-r--r--synapse/rest/media/v1/upload_resource.py8
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: