From 86c3f2c6a9b88b579295f5ccb7636fa09da6c944 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 13 2016 09:17:34 +0000 Subject: Handle the situation where the author of the commit did not specify an email We have the situation in one of our repo that the author of a commit specified his name but not his email. This leads to search_user returning the list of all the users in the DB instead of just the one we want and this makes pagure crash (crash that's been reported to us by email). With this fix, is the author has no email, we'll just return the provided name without searching further --- diff --git a/pagure/ui/filters.py b/pagure/ui/filters.py index 5d8e0b1..1e25782 100644 --- a/pagure/ui/filters.py +++ b/pagure/ui/filters.py @@ -306,8 +306,10 @@ def author_to_user(author, size=16): """ Template filter transforming a pygit2 Author object into a text either with just the username or linking to the user in pagure. """ - user = pagure.lib.search_user(SESSION, email=author.email) output = author.name + if not author.email: + return output + user = pagure.lib.search_user(SESSION, email=author.email) if user: output = "%s %s" % ( avatar(user.user, size),