From f652819e71c8330feba3cca4de026863b1fd323a Mon Sep 17 00:00:00 2001 From: ulferts Date: Fri, 28 Aug 2020 23:54:19 +0200 Subject: [PATCH] replace deprecated URI.encode in gravatar_image_tag --- .../open_project/avatars/patches/avatar_helper_patch.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/avatars/lib/open_project/avatars/patches/avatar_helper_patch.rb b/modules/avatars/lib/open_project/avatars/patches/avatar_helper_patch.rb index 6d4c5f1f08..86c808b330 100644 --- a/modules/avatars/lib/open_project/avatars/patches/avatar_helper_patch.rb +++ b/modules/avatars/lib/open_project/avatars/patches/avatar_helper_patch.rb @@ -26,6 +26,13 @@ AvatarHelper.class_eval do c.include_size_attributes = false end + # Override gems's method in order to avoid deprecated URI.escape + GravatarImageTag.define_singleton_method(:url_params) do |gravatar_params| + return nil if gravatar_params.keys.size == 0 + array = gravatar_params.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" } + "?#{array.join('&')}" + end + module InstanceMethods # Returns the avatar image tag for the given +user+ if avatars are enabled # +user+ can be a User or a string that will be scanned for an email address (eg. 'joe ')