Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ERB parsing <%== #589

Merged
merged 1 commit into from Dec 10, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/brakeman/parsers/rails3_erubis.rb
Expand Up @@ -29,7 +29,7 @@ def add_text(src, text)
end
end

BLOCK_EXPR = /\s+(do|\{)(\s*\|[^|]*\|)?\s*\Z/
BLOCK_EXPR = /\s*((\s+|\))do|\{)(\s*\|[^|]*\|)?\s*\Z/

def add_expr_literal(src, code)
if code =~ BLOCK_EXPR
Expand All @@ -43,7 +43,7 @@ def add_expr_escaped(src, code)
if code =~ BLOCK_EXPR
src << "@output_buffer.safe_append= " << code
else
src << "@output_buffer.safe_concat(" << code << ");"
src << "@output_buffer.safe_append= (" << code << ");"
end
end

Expand Down
2 changes: 2 additions & 0 deletions test/apps/rails4/app/views/users/test_parse.html.erb
@@ -0,0 +1,2 @@
Testing double ==
<%== %{t="#{stuff unless other? }"} if current_user %>