Skip to content

Commit

Permalink
Fix typo in error message when a media ID isn't known (#17865)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnjbvr authored Nov 12, 2024
1 parent f387f47 commit bfb197c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.d/17865.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Addressed some typos in docs and returned error message for unknown MXC ID.
2 changes: 1 addition & 1 deletion synapse/media/media_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ async def verify_can_upload(self, media_id: str, auth_user: UserID) -> None:
"""
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(
Expand Down
2 changes: 1 addition & 1 deletion synapse/rest/media/upload_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _get_file_metadata(

# 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

Expand Down
2 changes: 1 addition & 1 deletion tests/rest/admin/test_federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_invalid_parameter(self) -> None:
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",
Expand Down
2 changes: 1 addition & 1 deletion tests/rest/admin/test_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_invalid_parameter(self) -> None:
"""
If parameters are invalid, an error is returned.
"""
# unkown order_by
# unknown order_by
channel = self.make_request(
"GET",
self.url + "?order_by=bar",
Expand Down
4 changes: 2 additions & 2 deletions tests/rest/admin/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ def test_invalid_parameter(self) -> None:
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",
Expand Down Expand Up @@ -3696,7 +3696,7 @@ def test_limit_and_from_DELETE(self) -> None:
@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",
Expand Down

0 comments on commit bfb197c

Please sign in to comment.