Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
474abf1e
Commit
474abf1e
authored
5 years ago
by
Anshul Angaria
Committed by
Andrew Morgan
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add M_TOO_LARGE error code for uploading a too large file (#6151)
Fixes #6109
parent
ea7d938b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/6109.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/6109.bugfix
synapse/rest/media/v1/upload_resource.py
+6
-2
6 additions, 2 deletions
synapse/rest/media/v1/upload_resource.py
with
7 additions
and
2 deletions
changelog.d/6109.bugfix
0 → 100644
+
1
−
0
View file @
474abf1e
Fix bug when uploading a large file: Synapse responds with `M_UNKNOWN` while it should be `M_TOO_LARGE` according to spec. Contributed by Anshul Angaria.
This diff is collapsed.
Click to expand it.
synapse/rest/media/v1/upload_resource.py
+
6
−
2
View file @
474abf1e
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment