diff --git a/tagbot/action/repo.py b/tagbot/action/repo.py index 92c3037..4b9d5d6 100644 --- a/tagbot/action/repo.py +++ b/tagbot/action/repo.py @@ -156,16 +156,9 @@ def _registry_path(self) -> Optional[str]: registry = toml.load(f) else: contents = self._only(self._registry.get_contents("Registry.toml")) - # show file contents if cannot be decoded - try: - string_contents = contents.decoded_content.decode() - except AssertionError: - logger.info( - f"Registry.toml could not be decoded. Raw contents: {contents}" - ) - # rethrow now we've logged info - raise - + blob = self._registry.get_git_blob(contents.sha) + b64 = b64decode(blob.content) + string_contents = b64.decode("utf8") registry = toml.loads(string_contents) if uuid in registry["packages"]: diff --git a/test/action/test_repo.py b/test/action/test_repo.py index ceb30a5..d5d2396 100644 --- a/test/action/test_repo.py +++ b/test/action/test_repo.py @@ -101,10 +101,13 @@ def test_project_subdir(): def test_registry_path(): r = _repo() r._registry = Mock() - r._registry.get_contents.return_value.decoded_content = b""" - [packages] - abc-def = { path = "B/Bar" } - """ + r._registry.get_contents.return_value.sha = "123" + r._registry.get_git_blob.return_value.content = b64encode( + b""" + [packages] + abc-def = { path = "B/Bar" } + """ + ) r._project = lambda _k: "abc-ddd" assert r._registry_path is None r._project = lambda _k: "abc-def"