summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2025-03-06 21:42:27 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2025-03-06 21:42:27 +0000
commit40b6dce2de168df4838fbf7320d44ba74b4e710e (patch)
treeeaae30d07bf2661e8ff15ca2118e14e4c42715d3
parente29067913f73380ae30c026168a3e5576f8e33e8 (diff)
downloadredmine-40b6dce2de168df4838fbf7320d44ba74b4e710e.tar.gz
redmine-40b6dce2de168df4838fbf7320d44ba74b4e710e.zip
Correctly handle exception messages in macros (#42326).
Patch by Holger Just (user:hjust). git-svn-id: https://svn.redmine.org/redmine/trunk@23519 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/wiki_formatting/macros.rb2
-rw-r--r--test/unit/lib/redmine/wiki_formatting/macros_test.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/redmine/wiki_formatting/macros.rb b/lib/redmine/wiki_formatting/macros.rb
index 4de145c4c..ef1135cb6 100644
--- a/lib/redmine/wiki_formatting/macros.rb
+++ b/lib/redmine/wiki_formatting/macros.rb
@@ -53,7 +53,7 @@ module Redmine
send(method_name, obj, args)
end
rescue => e
- %|<div class="flash error">#{::I18n.t(:error_can_not_execute_macro_html, :name => name, :error => e.to_s)}</div>|.html_safe
+ %|<div class="flash error">#{::I18n.t(:error_can_not_execute_macro_html, :name => ::ERB::Util.h(name), :error => ::ERB::Util.h(e.to_s))}</div>|.html_safe
end
end
diff --git a/test/unit/lib/redmine/wiki_formatting/macros_test.rb b/test/unit/lib/redmine/wiki_formatting/macros_test.rb
index f23c76fdd..a41428266 100644
--- a/test/unit/lib/redmine/wiki_formatting/macros_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/macros_test.rb
@@ -140,12 +140,12 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest
def test_macro_exception_should_be_displayed
Redmine::WikiFormatting::Macros.macro :exception do |obj, args|
- raise "My message"
+ raise "My exception's message"
end
text = "{{exception}}"
assert_include(
- '<div class="flash error">Error executing the <strong>exception</strong> macro (My message)</div>',
+ '<div class="flash error">Error executing the <strong>exception</strong> macro (My exception&#39;s message)</div>',
textilizable(text)
)
end