Project

General

Profile

« Previous | Next » 

Revision ae095693

Added by Bryan Kearney about 10 years ago

Fixes #4884 : remove duplicate slashes from the gravatar url

The issue is that request.protocol returns http:// instead of http. The code assumed no trailing slashes

View differences:

app/controllers/application_controller.rb
# don't force SSL on localhost
return true if request.host=~/localhost|127.0.0.1/
# finally - redirect
redirect_to :protocol => 'https' and return if request.protocol != 'https' and not request.ssl?
redirect_to :protocol => 'https' and return if request.protocol != 'https://' and not request.ssl?
end
# This filter is called before FastGettext set_gettext_locale and sets user-defined locale
app/helpers/application_helper.rb
def gravatar_url(email, default_image)
return default_image if email.blank?
"#{request.protocol}//secure.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.downcase)}?d=mm&s=30"
"#{request.protocol}secure.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.downcase)}?d=mm&s=30"
end
def readonly_field(object, property, options={})

Also available in: Unified diff