Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
d7ebffb7
Commit
d7ebffb7
authored
Jan 16, 2012
by
Holger Just
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#795] Generate error flash on Liquid syntax error
parent
61a65d46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
application_helper.rb
app/helpers/application_helper.rb
+8
-5
liquid_test.rb
test/unit/lib/chili_project/liquid_test.rb
+8
-0
No files found.
app/helpers/application_helper.rb
View file @
d7ebffb7
...
...
@@ -295,7 +295,7 @@ module ApplicationHelper
projects
.
each
do
|
project
|
s
<<
"<label>
#{
check_box_tag
name
,
project
.
id
,
false
}
#{
h
project
}
</label>
\n
"
end
s
s
end
# Truncates and returns the string as a single line
...
...
@@ -487,14 +487,17 @@ module ApplicationHelper
Rails
.
logger
.
debug
msg
end
rescue
Liquid
::
SyntaxError
=>
exception
msg
=
"[Liquid Syntax Error]
#{
exception
.
message
}
"
if
Rails
.
logger
&&
Rails
.
logger
.
debug?
msg
=
"[Liquid Syntax Error]
#{
exception
.
message
}
\n
:
\n
#{
exception
.
backtrace
.
join
(
"
\n
"
)
}
"
msg
<<
"
\n\n
"
Rails
.
logger
.
debug
msg
log_msg
=
"
#{
msg
}
\n
"
log_msg
<<
exception
.
backtrace
.
collect
{
|
str
|
"
#{
str
}
"
}.
join
(
"
\n
"
)
log_msg
<<
"
\n\n
"
Rails
.
logger
.
debug
log_msg
end
# Skip Liquid if there is a syntax error
text
=
h
(
input_text
)
text
=
content_tag
(
:div
,
msg
,
:class
=>
"flash error"
)
text
<<
h
(
input_text
)
end
@parsed_headings
=
[]
...
...
test/unit/lib/chili_project/liquid_test.rb
View file @
d7ebffb7
...
...
@@ -229,5 +229,13 @@ class ChiliProject::LiquidTest < ActionView::TestCase
formatted
=
textilizable
(
text
)
assert_match
'<script>alert("Hello")</script>'
,
formatted
end
should
"have an error flash"
do
text
=
"{% --- something invalid %}
\n
"
formatted
=
textilizable
(
text
)
assert_match
/flash error/
,
formatted
assert_match
'[Liquid Syntax Error]'
,
formatted
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment