Project

General

Profile

Defect #41853 » 0001-Escape-labels-in-principals_check_box_tag.patch

Katsuya HIDAKA, 2024-11-29 19:26

View differences:

app/helpers/application_helper.rb
principal_check_box << check_box_tag(name, principal.id, false, :id => nil)
principal_check_box << avatar(principal, :size => 16).to_s if principal.is_a?(User)
principal_check_box << content_tag('span', principal_icon(principal), :class => "name icon icon-#{principal.class.to_s.downcase}")
principal_check_box << principal.to_s
principal_check_box << h(principal.to_s)
s << content_tag('label', principal_check_box.html_safe)
end
s.html_safe
test/helpers/application_helper_test.rb
end
end
def test_principals_check_box_tag_should_escape_principal_name
User.find(1).update!(firstname: "firstname<>'", lastname: 'lastname&"')
tags = principals_check_box_tags('watcher[user_ids][]', [User.find(1)])
assert_include 'firstname&lt;&gt;&#39; lastname&amp;&quot;', tags
end
def test_principals_options_for_select_with_users
User.current = nil
users = [User.find(2), User.find(4)]
(7-7/8)