Patch #40652 » 0001-Replaces-md5-with-SHA256-when-creating-the-hash-for-.patch
| lib/plugins/gravatar/lib/gravatar.rb | ||
|---|---|---|
|
# frozen_string_literal: true
|
||
|
require 'digest/md5'
|
||
|
require 'cgi'
|
||
|
module GravatarHelper
|
||
| ... | ... | |
|
# Return the gravatar URL for the given email address.
|
||
|
def gravatar_url(email, options={})
|
||
|
email_hash = Digest::MD5.hexdigest(email)
|
||
|
email_hash = Digest::SHA256.hexdigest(email)
|
||
|
options = DEFAULT_OPTIONS.merge(options)
|
||
|
options[:default] = CGI::escape(options[:default]) unless options[:default].nil?
|
||
|
gravatar_api_url(email_hash).tap do |url|
|
||
| test/helpers/avatars_helper_test.rb | ||
|---|---|---|
|
end
|
||
|
def test_avatar_with_user
|
||
|
assert_include Digest::MD5.hexdigest('jsmith@somenet.foo'), avatar(User.find_by_mail('jsmith@somenet.foo'))
|
||
|
assert_include Digest::SHA256.hexdigest('jsmith@somenet.foo'), avatar(User.find_by_mail('jsmith@somenet.foo'))
|
||
|
end
|
||
|
def test_avatar_with_email_string
|
||
|
assert_include Digest::MD5.hexdigest('jsmith@somenet.foo'), avatar('jsmith <jsmith@somenet.foo>')
|
||
|
assert_include Digest::SHA256.hexdigest('jsmith@somenet.foo'), avatar('jsmith <jsmith@somenet.foo>')
|
||
|
end
|
||
|
def test_avatar_with_anonymous_user
|
||