提交 46b97150 编写于 作者: J Justin Collins

Fix ERB parsing <%==

also update BLOCK_EXPR regex from head Rails
上级 4f75d763
...@@ -29,7 +29,7 @@ class Brakeman::Rails3Erubis < ::Erubis::Eruby ...@@ -29,7 +29,7 @@ class Brakeman::Rails3Erubis < ::Erubis::Eruby
end end
end end
BLOCK_EXPR = /\s+(do|\{)(\s*\|[^|]*\|)?\s*\Z/ BLOCK_EXPR = /\s*((\s+|\))do|\{)(\s*\|[^|]*\|)?\s*\Z/
def add_expr_literal(src, code) def add_expr_literal(src, code)
if code =~ BLOCK_EXPR if code =~ BLOCK_EXPR
...@@ -43,7 +43,7 @@ class Brakeman::Rails3Erubis < ::Erubis::Eruby ...@@ -43,7 +43,7 @@ class Brakeman::Rails3Erubis < ::Erubis::Eruby
if code =~ BLOCK_EXPR if code =~ BLOCK_EXPR
src << "@output_buffer.safe_append= " << code src << "@output_buffer.safe_append= " << code
else else
src << "@output_buffer.safe_concat(" << code << ");" src << "@output_buffer.safe_append= (" << code << ");"
end end
end end
......
Testing double ==
<%== %{t="#{stuff unless other? }"} if current_user %>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册