Fix typo in error message when a media ID isn't known (#17865)
This commit is contained in:
parent
f387f47a6a
commit
bfb197c596
|
@ -0,0 +1 @@
|
||||||
|
Addressed some typos in docs and returned error message for unknown MXC ID.
|
|
@ -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(
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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",
|
||||||
|
|
Loading…
Reference in New Issue