From: Marius Balteanu Date: Sun, 10 Nov 2024 11:37:38 +0000 (+0000) Subject: Fixes double-escaping issue for a principal name with special chars (#41721, #23980). X-Git-Tag: 6.0.0~6^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=505981c6824e0133ba2718e4d5e1f4c277a4e900;p=redmine.git Fixes double-escaping issue for a principal name with special chars (#41721, #23980). Patch by Katsuya HIDAKA (user:hidakatsuya). git-svn-id: https://svn.redmine.org/redmine/trunk@23228 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4a02d8376..806d59da1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -60,23 +60,23 @@ module ApplicationHelper only_path = options[:only_path].nil? ? true : options[:only_path] case principal when User - name = h(principal.name(options[:format])) - name = "@".html_safe + name if options[:mention] + name = principal.name(options[:format]) + name = "@#{name}" if options[:mention] css_classes = '' if principal.active? || (User.current.admin? && principal.logged?) url = user_url(principal, :only_path => only_path) css_classes += principal.css_classes end when Group - name = h(principal.to_s) + name = principal.to_s url = group_url(principal, :only_path => only_path) css_classes = principal.css_classes else - name = h(principal.to_s) + name = principal.to_s end css_classes += " #{options[:class]}" if css_classes && options[:class].present? - url ? link_to(principal_icon(principal.class.name.downcase).to_s + name, url, :class => css_classes) : name + url ? link_to(principal_icon(principal.class.name.downcase).to_s + name, url, :class => css_classes) : h(name) end # Displays a link to edit group page if current user is admin