summary refs log tree commit diff
path: root/synapse/rest/media/v1/upload_resource.py
diff options
context:
space:
mode:
authorShay <shaysquared@gmail.com>2021-11-01 10:26:02 -0700
committerGitHub <noreply@github.com>2021-11-01 10:26:02 -0700
commitf5c6a80886ac00482aaffa8e8ce3d98b31eab661 (patch)
treef6fc7ab3cc185fa37e145eea1c9b23089c99b280 /synapse/rest/media/v1/upload_resource.py
parentAdd `use_float=true` to ijson calls in Synapse (#11217) (diff)
downloadsynapse-f5c6a80886ac00482aaffa8e8ce3d98b31eab661.tar.xz
Handle missing Content-Type header when accessing remote media (#11200)
* add code to handle missing content-type header and a test to verify that it works

* add handling for missing content-type in the /upload endpoint as well

* slightly refactor test code to put private method in approriate place

* handle possible null value for content-type when pulling from the local db

* add changelog

* refactor test and add code to handle missing content-type in cached remote media

* requested changes

* Update changelog.d/11200.bugfix

Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>

Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
Diffstat (limited to 'synapse/rest/media/v1/upload_resource.py')
-rw-r--r--synapse/rest/media/v1/upload_resource.py2
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 7dcb1428e4..8162094cf6 100644 --- a/synapse/rest/media/v1/upload_resource.py +++ b/synapse/rest/media/v1/upload_resource.py
@@ -80,7 +80,7 @@ class UploadResource(DirectServeJsonResource): assert content_type_headers # for mypy media_type = content_type_headers[0].decode("ascii") else: - raise SynapseError(msg="Upload request missing 'Content-Type'", code=400) + media_type = "application/octet-stream" # if headers.hasHeader(b"Content-Disposition"): # disposition = headers.getRawHeaders(b"Content-Disposition")[0]