提交 dd414685 编写于 作者: A Aman Gupta 提交者: Mislav Marohnić

Fix fragment caching in mixed encodings scenario

To reduce ambiguity between char- and byte-based operations, explicitly
do byte operations when extracting the fragment that needs to be cached.
上级 cedf026a
......@@ -39,9 +39,9 @@ def fragment_for(buffer, name = {}, options = nil, &block) #:nodoc:
if cache = read_fragment(name, options)
buffer.safe_concat(cache.html_safe)
else
pos = buffer.length
pos = buffer.bytesize
block.call
write_fragment(name, buffer[pos..-1], options)
write_fragment(name, buffer.byteslice(pos..-1), options)
end
else
block.call
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册