mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
Fixed issue where "nil" value for "escape" filter breaks rendering
Closes #664
This commit is contained in:
@@ -33,7 +33,7 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def escape(input)
|
def escape(input)
|
||||||
CGI.escapeHTML(input).untaint
|
CGI.escapeHTML(input).untaint unless input.nil?
|
||||||
end
|
end
|
||||||
alias_method :h, :escape
|
alias_method :h, :escape
|
||||||
|
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ class StandardFiltersTest < Minitest::Test
|
|||||||
|
|
||||||
def test_escape
|
def test_escape
|
||||||
assert_equal '<strong>', @filters.escape('<strong>')
|
assert_equal '<strong>', @filters.escape('<strong>')
|
||||||
|
assert_equal nil, @filters.escape(nil)
|
||||||
assert_equal '<strong>', @filters.h('<strong>')
|
assert_equal '<strong>', @filters.h('<strong>')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user