Skip to content

Commit

Permalink
Merge branch '3-2-22-3' into 3-2-stable
Browse files Browse the repository at this point in the history
* 3-2-22-3:
  bumping version
  ensure tag/content_tag escapes " in attribute vals
  • Loading branch information
tenderlove committed Aug 11, 2016
2 parents d4a1b33 + ebc3639 commit 5efc4ec
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion RAILS_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.22.2
3.2.22.3
2 changes: 1 addition & 1 deletion actionmailer/lib/action_mailer/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module VERSION #:nodoc:
MAJOR = 3
MINOR = 2
TINY = 22
PRE = "2"
PRE = "3"

STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
end
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_pack/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module VERSION #:nodoc:
MAJOR = 3
MINOR = 2
TINY = 22
PRE = "2"
PRE = "3"

STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
end
Expand Down
15 changes: 11 additions & 4 deletions actionpack/lib/action_view/helpers/tag_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,27 @@ def tag_options(options, escape = true)
unless v.is_a?(String) || v.is_a?(Symbol) || v.is_a?(BigDecimal)
v = v.to_json
end
v = ERB::Util.html_escape(v) if escape
attrs << %(data-#{k.to_s.dasherize}="#{v}")
attrs << tag_option("data-#{k.to_s.dasherize}", v, escape)
end
elsif BOOLEAN_ATTRIBUTES.include?(key)
attrs << %(#{key}="#{key}") if value
elsif !value.nil?
final_value = value.is_a?(Array) ? value.join(" ") : value
final_value = ERB::Util.html_escape(final_value) if escape
attrs << %(#{key}="#{final_value}")
attrs << tag_option(key, value, escape)
end
end
" #{attrs.sort * ' '}".html_safe unless attrs.empty?
end
end

def tag_option(key, value, escape)
if value.is_a?(Array)
value = escape ? safe_join(value, " ") : value.join(" ")
else
value = escape ? ERB::Util.html_escape(value) : value
end
%(#{key}="#{value.gsub(/"/, '&quot;'.freeze)}")
end
end
end
end
10 changes: 10 additions & 0 deletions actionpack/test/template/tag_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ def test_tag_honors_html_safe_for_param_values
end
end

def test_tag_does_not_honor_html_safe_double_quotes_as_attributes
assert_dom_equal '<p title="&quot;">content</p>',
content_tag('p', "content", title: '"'.html_safe)
end

def test_data_tag_does_not_honor_html_safe_double_quotes_as_attributes
assert_dom_equal '<p data-title="&quot;">content</p>',
content_tag('p', "content", data: { title: '"'.html_safe })
end

def test_skip_invalid_escaped_attributes
['&1;', '&#1dfa3;', '& #123;'].each do |escaped|
assert_equal %(<a href="#{escaped.gsub(/&/, '&amp;')}" />), tag('a', :href => escaped)
Expand Down
2 changes: 1 addition & 1 deletion activemodel/lib/active_model/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module VERSION #:nodoc:
MAJOR = 3
MINOR = 2
TINY = 22
PRE = "2"
PRE = "3"

STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
end
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module VERSION #:nodoc:
MAJOR = 3
MINOR = 2
TINY = 22
PRE = "2"
PRE = "3"

STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
end
Expand Down
2 changes: 1 addition & 1 deletion activeresource/lib/active_resource/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module VERSION #:nodoc:
MAJOR = 3
MINOR = 2
TINY = 22
PRE = "2"
PRE = "3"

STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
end
Expand Down
2 changes: 1 addition & 1 deletion activesupport/lib/active_support/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module VERSION #:nodoc:
MAJOR = 3
MINOR = 2
TINY = 22
PRE = "2"
PRE = "3"

STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
end
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module VERSION #:nodoc:
MAJOR = 3
MINOR = 2
TINY = 22
PRE = "2"
PRE = "3"

STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
end
Expand Down
2 changes: 1 addition & 1 deletion version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module VERSION #:nodoc:
MAJOR = 3
MINOR = 2
TINY = 22
PRE = "2"
PRE = "3"

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

0 comments on commit 5efc4ec

Please sign in to comment.