Merge pull request #775 from netdata/gravatar_empty_issue

When the email address is empty gitlab will give a 500 error
This commit is contained in:
Valeriy Sizov 2012-05-03 06:19:49 -07:00
commit 12bb1d8f39

View file

@ -1,7 +1,7 @@
require 'digest/md5' require 'digest/md5'
module ApplicationHelper module ApplicationHelper
def gravatar_icon(user_email, size = 40) def gravatar_icon(user_email = '', size = 40)
gravatar_host = request.ssl? ? "https://secure.gravatar.com" : "http://www.gravatar.com" gravatar_host = request.ssl? ? "https://secure.gravatar.com" : "http://www.gravatar.com"
user_email.strip! user_email.strip!
"#{gravatar_host}/avatar/#{Digest::MD5.hexdigest(user_email.downcase)}?s=#{size}&d=identicon" "#{gravatar_host}/avatar/#{Digest::MD5.hexdigest(user_email.downcase)}?s=#{size}&d=identicon"