rigid set_attribute in for parsing

This commit is contained in:
Charles-P. Clermont
2025-10-27 16:33:31 +01:00
committed by Guilherme Carreiro
parent b8958f626d
commit b5fbad08c6
+4 -4
View File
@@ -104,7 +104,7 @@ module Liquid
raise SyntaxError, options[:locale].t("errors.syntax.for_invalid_attribute") raise SyntaxError, options[:locale].t("errors.syntax.for_invalid_attribute")
end end
p.consume(:colon) p.consume(:colon)
set_attribute(attribute, p.expression) set_attribute(attribute, p.expression, safe: true)
end end
p.consume(:end_of_string) p.consume(:end_of_string)
end end
@@ -178,16 +178,16 @@ module Liquid
output output
end end
def set_attribute(key, expr) def set_attribute(key, expr, safe: false)
case key case key
when 'offset' when 'offset'
@from = if expr == 'continue' @from = if expr == 'continue'
:continue :continue
else else
parse_expression(expr) parse_expression(expr, safe: safe)
end end
when 'limit' when 'limit'
@limit = parse_expression(expr) @limit = parse_expression(expr, safe: safe)
end end
end end