From 8da4af181543dc9a9e589926a128e46b4f936a1c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 27 2015 12:39:59 +0000 Subject: Handle the situation where we cannot find a desired commit Should fix the error seen in the logs: File "/srv/progit/pagure/ui/repo.py", line 435, in view_raw_file if commit.parents: AttributeError: 'NoneType' object has no attribute 'parents' --- diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index e396789..b583501 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -421,6 +421,9 @@ def view_raw_file(repo, identifier, filename=None, username=None): # If it's not a commit id then it's part of the filename commit = repo_obj[repo_obj.head.target] + if not commit: + flask.abort(400, 'Commit %s not found' % (identifier)) + mimetype = None encoding = None if filename: