From d7c7849bfab1bd4f36c4a5a990d4617587063d9b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 04 2015 08:32:36 +0000 Subject: Before showing a repo, check if the git repository exists and send a 404 otherwise --- diff --git a/progit/ui/repo.py b/progit/ui/repo.py index 4629794..113d31c 100644 --- a/progit/ui/repo.py +++ b/progit/ui/repo.py @@ -49,6 +49,10 @@ def view_repo(repo, username=None): reponame = os.path.join(APP.config['GIT_FOLDER'], repo.path) if repo.is_fork: reponame = os.path.join(APP.config['FORK_FOLDER'], repo.path) + + if not os.path.exists(reponame): + flask.abort(404, 'No git repo found') + repo_obj = pygit2.Repository(reponame) cnt = 0