Skip to content
Closed
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
2 changes: 2 additions & 0 deletions src/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ def get_index(self, allowed_media_type: Optional[list[str]] = None):
try:
self._check_200_response(response)
index = response.json()
# Ensure mediaType is set for existing indices
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would at least encourage you to validate if a mediaType is available at the response before overwriting it. In general the method is called get_index(). Manipulating the index in this context seems like an unwanted side-effect.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, this should really been in update_index(). I'll also check if it's available first.

index["mediaType"] = "application/vnd.oci.image.index.v1+json"
return index

except ValueError:
Expand Down
1 change: 1 addition & 0 deletions src/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"required": [
"schemaVersion",
"manifests",
"mediaType",
],
"properties": indexProperties,
"additionalProperties": True,
Expand Down
Loading