diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2020-08-03 16:22:52 -0700 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2020-08-03 16:22:52 -0700 |
commit | 3261eb71a6d02ac77fa69c9bcdfa07ec3bf10c03 (patch) | |
tree | 61601f44ccaabcda11fe5d9354c5745708f30ecb | |
parent | Merge commit '890c0c041' into dinsic (diff) | |
parent | Fetch from the r0 media path instead of the unspecced v1. (#7714) (diff) | |
download | synapse-3261eb71a6d02ac77fa69c9bcdfa07ec3bf10c03.tar.xz |
Merge commit '434716e1d' into dinsic
* commit '434716e1d': Fetch from the r0 media path instead of the unspecced v1. (#7714)
-rw-r--r-- | changelog.d/7714.bugfix | 1 | ||||
-rw-r--r-- | synapse/rest/media/v1/media_repository.py | 8 | ||||
-rw-r--r-- | tests/rest/media/v1/test_media_storage.py | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/changelog.d/7714.bugfix b/changelog.d/7714.bugfix new file mode 100644 index 0000000000..78925d94d1 --- /dev/null +++ b/changelog.d/7714.bugfix @@ -0,0 +1 @@ +Synapse will now fetch media from the proper specified URL (using the r0 prefix instead of the unspecified v1). diff --git a/synapse/rest/media/v1/media_repository.py b/synapse/rest/media/v1/media_repository.py index 4ee8c60257..45628c07b4 100644 --- a/synapse/rest/media/v1/media_repository.py +++ b/synapse/rest/media/v1/media_repository.py @@ -338,7 +338,7 @@ class MediaRepository(object): with self.media_storage.store_into_file(file_info) as (f, fname, finish): request_path = "/".join( - ("/_matrix/media/v1/download", server_name, media_id) + ("/_matrix/media/r0/download", server_name, media_id) ) try: length, headers = await self.client.get_file( @@ -703,7 +703,7 @@ class MediaRepositoryResource(Resource): Uploads are POSTed to a resource which returns a token which is used to GET the download:: - => POST /_matrix/media/v1/upload HTTP/1.1 + => POST /_matrix/media/r0/upload HTTP/1.1 Content-Type: <media-type> Content-Length: <content-length> @@ -714,7 +714,7 @@ class MediaRepositoryResource(Resource): { "content_uri": "mxc://<server-name>/<media-id>" } - => GET /_matrix/media/v1/download/<server-name>/<media-id> HTTP/1.1 + => GET /_matrix/media/r0/download/<server-name>/<media-id> HTTP/1.1 <= HTTP/1.1 200 OK Content-Type: <media-type> @@ -725,7 +725,7 @@ class MediaRepositoryResource(Resource): Clients can get thumbnails by supplying a desired width and height and thumbnailing method:: - => GET /_matrix/media/v1/thumbnail/<server_name> + => GET /_matrix/media/r0/thumbnail/<server_name> /<media-id>?width=<w>&height=<h>&method=<m> HTTP/1.1 <= HTTP/1.1 200 OK diff --git a/tests/rest/media/v1/test_media_storage.py b/tests/rest/media/v1/test_media_storage.py index aefe648bdb..2ed9312d56 100644 --- a/tests/rest/media/v1/test_media_storage.py +++ b/tests/rest/media/v1/test_media_storage.py @@ -232,7 +232,7 @@ class MediaRepoTests(unittest.HomeserverTestCase): self.assertEqual(len(self.fetches), 1) self.assertEqual(self.fetches[0][1], "example.com") self.assertEqual( - self.fetches[0][2], "/_matrix/media/v1/download/" + self.media_id + self.fetches[0][2], "/_matrix/media/r0/download/" + self.media_id ) self.assertEqual(self.fetches[0][3], {"allow_remote": "false"}) |