From 7c128e476844592badb94d306643ac327e70e96e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 05 2015 09:10:56 +0000 Subject: If there is no commit and no content, it means we didn't find the file: 404 --- diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index 55073ca..ce45096 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -353,6 +353,9 @@ def view_file(repo, identifier, filename, username=None): else: content = commit + if not content: + flask.abort(404, 'File not found') + if isinstance(content, pygit2.Blob): if content.is_binary or not pagure.lib.could_be_text(content.data): ext = filename[filename.rfind('.'):]