convert template source to string to ensure encoding validity

This commit is contained in:
Michael Go
2024-01-10 16:50:31 -04:00
parent 730ad3684a
commit 6a0fe3f7e3
3 changed files with 7 additions and 5 deletions
+2 -1
View File
@@ -107,8 +107,9 @@ module Liquid
# Returns self for easy chaining
def parse(source, options = {})
parse_context = configure_options(options)
source = source.to_s.to_str
if source.is_a?(String) && !source.valid_encoding?
unless source.valid_encoding?
raise SyntaxError, parse_context.locale.t("errors.syntax.invalid_template_encoding")
end