aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorYumin Wong <itsbagpack@github.com>2018-08-31 11:46:09 -0500
committerYumin Wong <itsbagpack@github.com>2018-08-31 11:46:09 -0500
commit3f5bd11ed651cef4f098c1d9dba16fe099e89a42 (patch)
treeedc966cc45c39996765a31f5da71a80d65c39221 /activesupport/lib
parent12fadea8aee3981654149d6e8ff5099bca31c679 (diff)
downloadrails-3f5bd11ed651cef4f098c1d9dba16fe099e89a42.tar.gz
rails-3f5bd11ed651cef4f098c1d9dba16fe099e89a42.tar.bz2
rails-3f5bd11ed651cef4f098c1d9dba16fe099e89a42.zip
SafeBuffer should maintain safety upon getting a slice via a range if original buffer was safe.
Co-Authored-By: no-itsbackpack <no-itsbackpack@github.com>
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/string/output_safety.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb
index f3bdc2977e..d837bb10aa 100644
--- a/activesupport/lib/active_support/core_ext/string/output_safety.rb
+++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -149,9 +149,7 @@ module ActiveSupport #:nodoc:
end
def [](*args)
- if args.size < 2
- super
- elsif html_safe?
+ if html_safe?
new_safe_buffer = super
if new_safe_buffer