diff --git a/pagure/hooks/__init__.py b/pagure/hooks/__init__.py index ed2e2a2..d6e461f 100644 --- a/pagure/hooks/__init__.py +++ b/pagure/hooks/__init__.py @@ -11,6 +11,7 @@ import os import shutil import wtforms +import flask from pagure import APP, get_repo_path @@ -119,6 +120,9 @@ class BaseHook(object): ''' for repopath in repopaths: + if not os.path.exists(repopath): + flask.abort(404, 'No git repo found') + if hook_name in ['pagureforcecommit', 'pagureunsignedcommit']: hook_path = os.path.join(repopath, 'hooks', 'pre-receive.' + hook_name)