diff options
author | Sergey Nartimov <just.lest@gmail.com> | 2012-02-20 15:41:17 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-20 15:41:17 -0800 |
commit | 7b73913701ff41981d166ca457e41690aac3bce3 (patch) | |
tree | 8badfe64d7a783fb19d3e3756c186fb539e054c8 /actionpack/lib/action_view/helpers/form_options_helper.rb | |
parent | b80d8f71112279f989ad3accbfed277a25cedd57 (diff) | |
download | rails-7b73913701ff41981d166ca457e41690aac3bce3.tar.gz rails-7b73913701ff41981d166ca457e41690aac3bce3.tar.bz2 rails-7b73913701ff41981d166ca457e41690aac3bce3.zip |
fix output safety issue with select options
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_options_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_options_helper.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index e00ac8f3f2..f64d3907a2 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -616,13 +616,13 @@ module ActionView private def add_options(option_tags, options, value = nil) if options[:include_blank] - option_tags = "<option value=\"\">#{ERB::Util.html_escape(options[:include_blank]) if options[:include_blank].kind_of?(String)}</option>\n" + option_tags + option_tags = content_tag('option', options[:include_blank].kind_of?(String) ? options[:include_blank] : nil, :value => '') + "\n" + option_tags end if value.blank? && options[:prompt] prompt = options[:prompt].kind_of?(String) ? options[:prompt] : I18n.translate('helpers.select.prompt', :default => 'Please select') - option_tags = "<option value=\"\">#{ERB::Util.html_escape(prompt)}</option>\n" + option_tags + option_tags = content_tag('option', prompt, :value => '') + "\n" + option_tags end - option_tags.html_safe + option_tags end def select_content_tag(option_tags, options, html_options) |