mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
convert template source to string to ensure encoding validity
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ module Liquid
|
||||
attr_reader :line_number, :for_liquid_tag
|
||||
|
||||
def initialize(source, line_numbers = false, line_number: nil, for_liquid_tag: false)
|
||||
@source = source.to_s.to_str
|
||||
@source = source
|
||||
@line_number = line_number || (line_numbers ? 1 : nil)
|
||||
@for_liquid_tag = for_liquid_tag
|
||||
@offset = 0
|
||||
|
||||
Reference in New Issue
Block a user