Skip to content
Open
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
6 changes: 4 additions & 2 deletions tagbot/action/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,10 @@ def _registry_path(self) -> Optional[str]:
"This may indicate a structural issue with the registry file."
)
return None
if uuid in registry["packages"]:
self.__registry_path = registry["packages"][uuid]["path"]
# Normalize registry package UUIDs to lowercase for case-insensitive matching
packages_lower = {k.lower(): v for k, v in registry["packages"].items()}
if uuid in packages_lower:
self.__registry_path = packages_lower[uuid]["path"]
return self.__registry_path
return None

Expand Down
17 changes: 17 additions & 0 deletions test/action/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,23 @@ def test_registry_path_with_uppercase_uuid():
assert r._registry_path == "B/Bar"


def test_registry_path_with_uppercase_registry_uuid():
"""Test that uppercase UUIDs in the registry are normalized for matching."""
r = _repo()
r._registry = Mock()
r._registry.get_contents.return_value.sha = "123"
# Registry has uppercase UUID
r._registry.get_git_blob.return_value.content = b64encode(
b"""
[packages]
ABC-DEF-1234 = { path = "P/Package" }
"""
)
# Project has lowercase UUID
r._project = lambda _k: "abc-def-1234"
assert r._registry_path == "P/Package"


@patch("tagbot.action.repo.logger")
def test_registry_path_malformed_toml(logger):
"""Test that malformed Registry.toml returns None and logs warning."""
Expand Down