From af416edb2dbdb328a92cad1d5ca1e50ad5771c89 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 6 May 2020 10:43:41 -0400 Subject: [PATCH] repo: generalize lookup_ref 404 implementation --- gitsrht/blueprints/repo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitsrht/blueprints/repo.py b/gitsrht/blueprints/repo.py index 52fe049..3e56e0b 100644 --- a/gitsrht/blueprints/repo.py +++ b/gitsrht/blueprints/repo.py @@ -179,6 +179,8 @@ def lookup_ref(git_repo, ref, path): abort(404) if isinstance(commit, pygit2.Tag): commit = git_repo.get(commit.target) + if not commit: + abort(404) return commit, ref, "/".join(path) @repo.route("///tree", defaults={"ref": None, "path": ""}) @@ -200,8 +202,6 @@ def tree(owner, repo, ref, path): if isinstance(commit, pygit2.Tag): commit = git_repo.get(commit.target) orig_commit = commit - if not commit: - abort(404) tree = commit.tree if not tree: abort(404) -- 2.38.4