Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

replace deprecated URI.encode in gravatar_image_tag

ulfertsf652819e71c8
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 6d4c5f1f084..86c808b3305 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 <[email protected]>')