Fix typo in error message when a media ID isn't known (#17865)

This commit is contained in:
Benjamin Bouvier 2024-11-12 17:41:14 +01:00 committed by GitHub
parent f387f47a6a
commit bfb197c596
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 7 additions and 6 deletions

1
changelog.d/17865.misc Normal file
View file

@ -0,0 +1 @@
Addressed some typos in docs and returned error message for unknown MXC ID.

View file

@ -259,7 +259,7 @@ class MediaRepository:
""" """
media = await self.store.get_local_media(media_id) media = await self.store.get_local_media(media_id)
if media is None: 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(): if media.user_id != auth_user.to_string():
raise SynapseError( raise SynapseError(

View file

@ -94,7 +94,7 @@ class BaseUploadServlet(RestServlet):
# if headers.hasHeader(b"Content-Disposition"): # if headers.hasHeader(b"Content-Disposition"):
# disposition = headers.getRawHeaders(b"Content-Disposition")[0] # disposition = headers.getRawHeaders(b"Content-Disposition")[0]
# TODO(markjh): parse content-dispostion # TODO(markjh): parse content-disposition
return content_length, upload_name, media_type return content_length, upload_name, media_type

View file

@ -96,7 +96,7 @@ class FederationTestCase(unittest.HomeserverTestCase):
self.assertEqual(400, channel.code, msg=channel.json_body) self.assertEqual(400, channel.code, msg=channel.json_body)
self.assertEqual(Codes.INVALID_PARAM, channel.json_body["errcode"]) self.assertEqual(Codes.INVALID_PARAM, channel.json_body["errcode"])
# unkown order_by # unknown order_by
channel = self.make_request( channel = self.make_request(
"GET", "GET",
self.url + "?order_by=bar", self.url + "?order_by=bar",

View file

@ -82,7 +82,7 @@ class UserMediaStatisticsTestCase(unittest.HomeserverTestCase):
""" """
If parameters are invalid, an error is returned. If parameters are invalid, an error is returned.
""" """
# unkown order_by # unknown order_by
channel = self.make_request( channel = self.make_request(
"GET", "GET",
self.url + "?order_by=bar", self.url + "?order_by=bar",

View file

@ -719,7 +719,7 @@ class UsersListTestCase(unittest.HomeserverTestCase):
self.assertEqual(400, channel.code, msg=channel.json_body) self.assertEqual(400, channel.code, msg=channel.json_body)
self.assertEqual(Codes.INVALID_PARAM, channel.json_body["errcode"]) self.assertEqual(Codes.INVALID_PARAM, channel.json_body["errcode"])
# unkown order_by # unknown order_by
channel = self.make_request( channel = self.make_request(
"GET", "GET",
self.url + "?order_by=bar", self.url + "?order_by=bar",
@ -3696,7 +3696,7 @@ class UserMediaRestTestCase(unittest.HomeserverTestCase):
@parameterized.expand(["GET", "DELETE"]) @parameterized.expand(["GET", "DELETE"])
def test_invalid_parameter(self, method: str) -> None: def test_invalid_parameter(self, method: str) -> None:
"""If parameters are invalid, an error is returned.""" """If parameters are invalid, an error is returned."""
# unkown order_by # unknown order_by
channel = self.make_request( channel = self.make_request(
method, method,
self.url + "?order_by=bar", self.url + "?order_by=bar",