diff options
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/text_helper.rb | 4 | ||||
-rw-r--r-- | actionview/lib/action_view/helpers/url_helper.rb | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/actionview/lib/action_view/helpers/text_helper.rb b/actionview/lib/action_view/helpers/text_helper.rb index 6fe250d3c1..e3d4eb1d74 100644 --- a/actionview/lib/action_view/helpers/text_helper.rb +++ b/actionview/lib/action_view/helpers/text_helper.rb @@ -215,7 +215,7 @@ module ActionView def word_wrap(text, options = {}) line_width = options.fetch(:line_width, 80) - text.split("\n").collect do |line| + text.split("\n").collect! do |line| line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip : line end * "\n" end @@ -264,7 +264,7 @@ module ActionView if paragraphs.empty? content_tag(wrapper_tag, nil, html_options) else - paragraphs.map { |paragraph| + paragraphs.map! { |paragraph| content_tag(wrapper_tag, paragraph, html_options, options[:sanitize]) }.join("\n\n").html_safe end diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index a4f04b0b3b..db0fb40336 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -528,12 +528,13 @@ module ActionView return false unless request.get? || request.head? - url_string = url_for(options) + url_string = URI.unescape(url_for(options)).force_encoding(Encoding::BINARY) # We ignore any extra parameters in the request_uri if the # submitted url doesn't have any either. This lets the function # work with things like ?order=asc request_uri = url_string.index("?") ? request.fullpath : request.path + request_uri = URI.unescape(request_uri).force_encoding(Encoding::BINARY) if url_string =~ /^\w+:\/\// url_string == "#{request.protocol}#{request.host_with_port}#{request_uri}" |