Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -717,7 +717,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 @@ -3694,7 +3694,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
Loading