From 0df2a1a9534c46aa81df0ed37d089b69406e0ff4 Mon Sep 17 00:00:00 2001 From: Armin Weigl Date: Sat, 13 Mar 2021 20:30:08 +0100 Subject: [PATCH] Fix /api/~o/repos/r/refs 500ing on non utf-8 ref --- gitsrht/blueprints/api/porcelain.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitsrht/blueprints/api/porcelain.py b/gitsrht/blueprints/api/porcelain.py index 66e6add..7be92c1 100644 --- a/gitsrht/blueprints/api/porcelain.py +++ b/gitsrht/blueprints/api/porcelain.py @@ -60,7 +60,7 @@ def ref_to_dict(artifacts, ref): target = ref.target.hex return { "target": target, - "name": ref.name, + "name": ref.raw_name.decode("utf-8", "replace"), "artifacts": [a.to_dict() for a in artifacts.get(target, [])], } @@ -73,7 +73,7 @@ def repo_refs_GET(username, reponame): with GitRepository(repo.path) as git_repo: # TODO: pagination - refs = list(git_repo.references) + refs = list(git_repo.raw_listall_references()) targets = [git_repo.references[ref].target.hex for ref in refs] artifacts = (Artifact.query .filter(Artifact.user_id == repo.owner_id) -- 2.38.4