diff --git a/tagbot/action/repo.py b/tagbot/action/repo.py index 63449ac..c2e7001 100644 --- a/tagbot/action/repo.py +++ b/tagbot/action/repo.py @@ -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 diff --git a/test/action/test_repo.py b/test/action/test_repo.py index 91b4b03..8440e9d 100644 --- a/test/action/test_repo.py +++ b/test/action/test_repo.py @@ -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."""