Commit d7bd31c6 authored by Pierre-Yves Chibon's avatar Pierre-Yves Chibon

Add a check that the git repo actually exists and return a 404 otherwise

parent 014417cf
......@@ -441,7 +441,16 @@ def get_branches_of_commit():
response.status_code = 404
return response
reponame = pagure.get_repo_path(repo)
reponame = os.path.join(pagure.APP.config['GIT_FOLDER'], repo.path)
if not os.path.exists(reponame):
response = flask.jsonify({
'code': 'ERROR',
'message': 'No git repo found with the information provided',
response.status_code = 404
return response
repo_obj = pygit2.Repository(reponame)
branches = []
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment