]> source.dussan.org Git - redmine.git/commitdiff
Fixes double-escaping issue for a principal name with special chars (#41721, #23980).
authorMarius Balteanu <marius.balteanu@zitec.com>
Sun, 10 Nov 2024 11:37:38 +0000 (11:37 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Sun, 10 Nov 2024 11:37:38 +0000 (11:37 +0000)
Patch by Katsuya HIDAKA (user:hidakatsuya).

git-svn-id: https://svn.redmine.org/redmine/trunk@23228 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb

index 4a02d8376b128a64ea56b6c1caf7443162f64dd7..806d59da1141dac590fefe36cd32785159fe8b09 100644 (file)
@@ -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