Skip to content

Commit 5efc4ec

Browse files
committed
Merge branch '3-2-22-3' into 3-2-stable
* 3-2-22-3: bumping version ensure tag/content_tag escapes " in attribute vals
2 parents d4a1b33 + ebc3639 commit 5efc4ec

File tree

11 files changed

+30
-13
lines changed

11 files changed

+30
-13
lines changed

RAILS_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.22.2
1+
3.2.22.3

actionmailer/lib/action_mailer/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module VERSION #:nodoc:
33
MAJOR = 3
44
MINOR = 2
55
TINY = 22
6-
PRE = "2"
6+
PRE = "3"
77

88
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
99
end

actionpack/lib/action_pack/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module VERSION #:nodoc:
33
MAJOR = 3
44
MINOR = 2
55
TINY = 22
6-
PRE = "2"
6+
PRE = "3"
77

88
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
99
end

actionpack/lib/action_view/helpers/tag_helper.rb

+11-4
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,27 @@ def tag_options(options, escape = true)
141141
unless v.is_a?(String) || v.is_a?(Symbol) || v.is_a?(BigDecimal)
142142
v = v.to_json
143143
end
144-
v = ERB::Util.html_escape(v) if escape
145-
attrs << %(data-#{k.to_s.dasherize}="#{v}")
144+
attrs << tag_option("data-#{k.to_s.dasherize}", v, escape)
146145
end
147146
elsif BOOLEAN_ATTRIBUTES.include?(key)
148147
attrs << %(#{key}="#{key}") if value
149148
elsif !value.nil?
150149
final_value = value.is_a?(Array) ? value.join(" ") : value
151-
final_value = ERB::Util.html_escape(final_value) if escape
152-
attrs << %(#{key}="#{final_value}")
150+
attrs << tag_option(key, value, escape)
153151
end
154152
end
155153
" #{attrs.sort * ' '}".html_safe unless attrs.empty?
156154
end
157155
end
156+
157+
def tag_option(key, value, escape)
158+
if value.is_a?(Array)
159+
value = escape ? safe_join(value, " ") : value.join(" ")
160+
else
161+
value = escape ? ERB::Util.html_escape(value) : value
162+
end
163+
%(#{key}="#{value.gsub(/"/, '&quot;'.freeze)}")
164+
end
158165
end
159166
end
160167
end

actionpack/test/template/tag_helper_test.rb

+10
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ def test_tag_honors_html_safe_for_param_values
101101
end
102102
end
103103

104+
def test_tag_does_not_honor_html_safe_double_quotes_as_attributes
105+
assert_dom_equal '<p title="&quot;">content</p>',
106+
content_tag('p', "content", title: '"'.html_safe)
107+
end
108+
109+
def test_data_tag_does_not_honor_html_safe_double_quotes_as_attributes
110+
assert_dom_equal '<p data-title="&quot;">content</p>',
111+
content_tag('p', "content", data: { title: '"'.html_safe })
112+
end
113+
104114
def test_skip_invalid_escaped_attributes
105115
['&1;', '&#1dfa3;', '& #123;'].each do |escaped|
106116
assert_equal %(<a href="#{escaped.gsub(/&/, '&amp;')}" />), tag('a', :href => escaped)

activemodel/lib/active_model/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module VERSION #:nodoc:
33
MAJOR = 3
44
MINOR = 2
55
TINY = 22
6-
PRE = "2"
6+
PRE = "3"
77

88
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
99
end

activerecord/lib/active_record/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module VERSION #:nodoc:
33
MAJOR = 3
44
MINOR = 2
55
TINY = 22
6-
PRE = "2"
6+
PRE = "3"
77

88
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
99
end

activeresource/lib/active_resource/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module VERSION #:nodoc:
33
MAJOR = 3
44
MINOR = 2
55
TINY = 22
6-
PRE = "2"
6+
PRE = "3"
77

88
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
99
end

activesupport/lib/active_support/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module VERSION #:nodoc:
33
MAJOR = 3
44
MINOR = 2
55
TINY = 22
6-
PRE = "2"
6+
PRE = "3"
77

88
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
99
end

railties/lib/rails/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module VERSION #:nodoc:
33
MAJOR = 3
44
MINOR = 2
55
TINY = 22
6-
PRE = "2"
6+
PRE = "3"
77

88
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
99
end

version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module VERSION #:nodoc:
33
MAJOR = 3
44
MINOR = 2
55
TINY = 22
6-
PRE = "2"
6+
PRE = "3"
77

88
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
99
end

0 commit comments

Comments
 (0)