mirror of
https://github.com/github/rails.git
synced 2026-01-14 09:08:02 -05:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f63b0340ff | ||
|
|
7224ee1419 | ||
|
|
0c52ae6df3 | ||
|
|
f8b7cd2df7 | ||
|
|
c73ba86136 | ||
|
|
98fa5dd465 | ||
|
|
fa41bedf6b | ||
|
|
0a8282c557 | ||
|
|
d4a4facfcc | ||
|
|
dd4146854a |
@@ -1 +1 @@
|
|||||||
2.3.14.github33
|
2.3.14.github34
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ module ActionController #:nodoc:
|
|||||||
if cache = read_fragment(name, options)
|
if cache = read_fragment(name, options)
|
||||||
buffer.safe_concat(cache.html_safe)
|
buffer.safe_concat(cache.html_safe)
|
||||||
else
|
else
|
||||||
pos = buffer.length
|
pos = buffer.bytesize
|
||||||
block.call
|
block.call
|
||||||
write_fragment(name, buffer[pos..-1], options)
|
write_fragment(name, buffer.byteslice(pos..-1), options)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
block.call
|
block.call
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ module ActionView
|
|||||||
src << "@output_buffer.safe_append='"
|
src << "@output_buffer.safe_append='"
|
||||||
src << "\n" * @newline_pending if @newline_pending > 0
|
src << "\n" * @newline_pending if @newline_pending > 0
|
||||||
src << escape_text(text)
|
src << escape_text(text)
|
||||||
src << "';"
|
src << "'.freeze;"
|
||||||
|
|
||||||
@newline_pending = 0
|
@newline_pending = 0
|
||||||
end
|
end
|
||||||
@@ -63,7 +63,7 @@ module ActionView
|
|||||||
|
|
||||||
def flush_newline_if_pending(src)
|
def flush_newline_if_pending(src)
|
||||||
if @newline_pending > 0
|
if @newline_pending > 0
|
||||||
src << "@output_buffer.safe_append='#{"\n" * @newline_pending}';"
|
src << "@output_buffer.safe_append='#{"\n" * @newline_pending}'.freeze;"
|
||||||
@newline_pending = 0
|
@newline_pending = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -622,6 +622,19 @@ class FragmentCachingTest < ActionController::TestCase
|
|||||||
assert_equal 'generated till now -> fragment content', buffer
|
assert_equal 'generated till now -> fragment content', buffer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_fragment_for_bytesize
|
||||||
|
buffer = "\xC4\x8D"
|
||||||
|
buffer.force_encoding('ASCII-8BIT')
|
||||||
|
|
||||||
|
@controller.fragment_for(buffer, 'bytesize') do
|
||||||
|
buffer.force_encoding('UTF-8')
|
||||||
|
buffer << "abc"
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_equal Encoding::UTF_8, buffer.encoding
|
||||||
|
assert_equal "abc", @store.read('views/bytesize')
|
||||||
|
end
|
||||||
|
|
||||||
def test_html_safety
|
def test_html_safety
|
||||||
assert_nil @store.read('views/name')
|
assert_nil @store.read('views/name')
|
||||||
content = 'value'.html_safe
|
content = 'value'.html_safe
|
||||||
|
|||||||
@@ -299,7 +299,11 @@ HELP
|
|||||||
# Evaluate any assignments in a temporary, throwaway binding.
|
# Evaluate any assignments in a temporary, throwaway binding.
|
||||||
vars = template_options[:assigns] || {}
|
vars = template_options[:assigns] || {}
|
||||||
b = template_options[:binding] || binding
|
b = template_options[:binding] || binding
|
||||||
vars.each { |k,v| eval "#{k} = vars[:#{k}] || vars['#{k}']", b }
|
if b.respond_to?(:local_variable_set)
|
||||||
|
vars.each { |k,v| b.local_variable_set(k, v) }
|
||||||
|
else
|
||||||
|
vars.each { |k,v| eval "#{k} = vars[:#{k}] || vars['#{k}']", b }
|
||||||
|
end
|
||||||
|
|
||||||
# Render the source file with the temporary binding.
|
# Render the source file with the temporary binding.
|
||||||
ERB.new(file.read, nil, '-').result(b)
|
ERB.new(file.read, nil, '-').result(b)
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ set -x
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
script/cibuild-on 1.9.3-p231-tcs-github
|
script/cibuild-on 1.9.3-p231-tcs-github
|
||||||
script/cibuild-on 2.0.0-github
|
script/cibuild-on 2.1.0-github
|
||||||
|
|||||||
Reference in New Issue
Block a user