From d2cd785d657e12c44b855316650672d876758c41 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 17 Nov 2019 13:36:13 -0500 Subject: [PATCH] Handle errors from pygit2 with user-supplied data This isn't a security issue or anything, it just saves me the error emails. --- gitsrht/blueprints/repo.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gitsrht/blueprints/repo.py b/gitsrht/blueprints/repo.py index 55d95a0..ea89bf3 100644 --- a/gitsrht/blueprints/repo.py +++ b/gitsrht/blueprints/repo.py @@ -295,7 +295,10 @@ def log(owner, repo, ref, path): from_id = request.args.get("from") if from_id: - commit = git_repo.get(from_id) + try: + commit = git_repo.get(from_id) + except ValueError: + abort(404) commits = get_log(git_repo, commit) -- 2.38.4