Merge pull request #665 from tanelj/escape_filter_nil_fix

Fixed issue where "nil" value for "escape" filter breaks rendering
This commit is contained in:
Dylan Thacker-Smith
2015-11-06 10:54:48 -05:00
2 changed files with 2 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ module Liquid
end
def escape(input)
CGI.escapeHTML(input).untaint
CGI.escapeHTML(input).untaint unless input.nil?
end
alias_method :h, :escape

View File

@@ -118,6 +118,7 @@ class StandardFiltersTest < Minitest::Test
def test_escape
assert_equal '&lt;strong&gt;', @filters.escape('<strong>')
assert_equal nil, @filters.escape(nil)
assert_equal '&lt;strong&gt;', @filters.h('<strong>')
end