From bfb197c596f751bc9c4ed5c807b406a31385ae77 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Tue, 12 Nov 2024 17:41:14 +0100 Subject: [PATCH] Fix typo in error message when a media ID isn't known (#17865) --- changelog.d/17865.misc | 1 + synapse/media/media_repository.py | 2 +- synapse/rest/media/upload_resource.py | 2 +- tests/rest/admin/test_federation.py | 2 +- tests/rest/admin/test_statistics.py | 2 +- tests/rest/admin/test_user.py | 4 ++-- 6 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 changelog.d/17865.misc diff --git a/changelog.d/17865.misc b/changelog.d/17865.misc new file mode 100644 index 0000000000..2303a7e1b7 --- /dev/null +++ b/changelog.d/17865.misc @@ -0,0 +1 @@ +Addressed some typos in docs and returned error message for unknown MXC ID. diff --git a/synapse/media/media_repository.py b/synapse/media/media_repository.py index 0b74209232..f4d25a7b8b 100644 --- a/synapse/media/media_repository.py +++ b/synapse/media/media_repository.py @@ -259,7 +259,7 @@ class MediaRepository: """ media = await self.store.get_local_media(media_id) if media is None: - raise SynapseError(404, "Unknow media ID", errcode=Codes.NOT_FOUND) + raise NotFoundError("Unknown media ID") if media.user_id != auth_user.to_string(): raise SynapseError( diff --git a/synapse/rest/media/upload_resource.py b/synapse/rest/media/upload_resource.py index 5ef6bf8836..359d006f04 100644 --- a/synapse/rest/media/upload_resource.py +++ b/synapse/rest/media/upload_resource.py @@ -94,7 +94,7 @@ class BaseUploadServlet(RestServlet): # if headers.hasHeader(b"Content-Disposition"): # disposition = headers.getRawHeaders(b"Content-Disposition")[0] - # TODO(markjh): parse content-dispostion + # TODO(markjh): parse content-disposition return content_length, upload_name, media_type diff --git a/tests/rest/admin/test_federation.py b/tests/rest/admin/test_federation.py index c2015774a1..d5ae3345f5 100644 --- a/tests/rest/admin/test_federation.py +++ b/tests/rest/admin/test_federation.py @@ -96,7 +96,7 @@ class FederationTestCase(unittest.HomeserverTestCase): self.assertEqual(400, channel.code, msg=channel.json_body) self.assertEqual(Codes.INVALID_PARAM, channel.json_body["errcode"]) - # unkown order_by + # unknown order_by channel = self.make_request( "GET", self.url + "?order_by=bar", diff --git a/tests/rest/admin/test_statistics.py b/tests/rest/admin/test_statistics.py index 5f60e19e56..07ec49c4e5 100644 --- a/tests/rest/admin/test_statistics.py +++ b/tests/rest/admin/test_statistics.py @@ -82,7 +82,7 @@ class UserMediaStatisticsTestCase(unittest.HomeserverTestCase): """ If parameters are invalid, an error is returned. """ - # unkown order_by + # unknown order_by channel = self.make_request( "GET", self.url + "?order_by=bar", diff --git a/tests/rest/admin/test_user.py b/tests/rest/admin/test_user.py index f9ae50f40a..668ccb89ff 100644 --- a/tests/rest/admin/test_user.py +++ b/tests/rest/admin/test_user.py @@ -719,7 +719,7 @@ class UsersListTestCase(unittest.HomeserverTestCase): self.assertEqual(400, channel.code, msg=channel.json_body) self.assertEqual(Codes.INVALID_PARAM, channel.json_body["errcode"]) - # unkown order_by + # unknown order_by channel = self.make_request( "GET", self.url + "?order_by=bar", @@ -3696,7 +3696,7 @@ class UserMediaRestTestCase(unittest.HomeserverTestCase): @parameterized.expand(["GET", "DELETE"]) def test_invalid_parameter(self, method: str) -> None: """If parameters are invalid, an error is returned.""" - # unkown order_by + # unknown order_by channel = self.make_request( method, self.url + "?order_by=bar",