mirror of
https://github.com/redmine/redmine.git
synced 2025-11-15 09:46:02 +01:00
Fix render_flash_messages method to ignore non-string flash values and prevent errors (#42073).
Patch by Katsuya HIDAKA (user:hidakatsuya). git-svn-id: https://svn.redmine.org/redmine/trunk@23821 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -518,6 +518,8 @@ module ApplicationHelper
|
||||
def render_flash_messages
|
||||
s = +''
|
||||
flash.each do |k, v|
|
||||
next unless v.is_a?(String)
|
||||
|
||||
s << content_tag('div', notice_icon(k) + v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
|
||||
end
|
||||
s.html_safe
|
||||
|
||||
@@ -2403,6 +2403,14 @@ class ApplicationHelperTest < Redmine::HelperTest
|
||||
assert_equal expected, format_activity_description(text)
|
||||
end
|
||||
|
||||
def test_render_flash_messages_should_ignore_non_string_values
|
||||
flash[:array_value] = ['1', '2']
|
||||
flash[:hash_value] = { foo: 'bar' }
|
||||
|
||||
result = render_flash_messages
|
||||
assert_equal '', result
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def wiki_links_with_special_characters
|
||||
|
||||
Reference in New Issue
Block a user