From a74a5c15673787d5601862a9456ae0b9c0674510 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 3 Oct 2018 08:42:45 -0400 Subject: [PATCH] Fix 500 on ref detail page --- gitsrht/blueprints/repo.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gitsrht/blueprints/repo.py b/gitsrht/blueprints/repo.py index 93e87c4..248376d 100644 --- a/gitsrht/blueprints/repo.py +++ b/gitsrht/blueprints/repo.py @@ -383,6 +383,11 @@ def ref(owner, repo, ref): if not has_access(repo, UserAccess.read): abort(401) git_repo = CachedRepository(repo.path) - commit, ref = lookup_ref(git_repo, ref) + try: + tag = git_repo.revparse_single(ref) + except KeyError: + abort(404) + except ValueError: + abort(404) return render_template("ref.html", view="refs", owner=owner, repo=repo, git_repo=git_repo, tag=tag) -- 2.38.4