From 4c07ff920b15f16d4e31008c57429217d0eb37d1 Mon Sep 17 00:00:00 2001 From: Marco Concetto Rudilosso Date: Wed, 2 Apr 2025 15:08:34 +0200 Subject: [PATCH] Revert "Always stringify properties in all array filters (#1936)" This reverts commit aa1640035f172bcbd064959d8e7d00aac07243d7. --- lib/liquid/standardfilters.rb | 11 ----------- lib/liquid/version.rb | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/lib/liquid/standardfilters.rb b/lib/liquid/standardfilters.rb index daa2c580..1864742e 100644 --- a/lib/liquid/standardfilters.rb +++ b/lib/liquid/standardfilters.rb @@ -386,7 +386,6 @@ module Liquid end elsif ary.all? { |el| el.respond_to?(:[]) } begin - property = Utils.to_s(property) ary.sort { |a, b| nil_safe_compare(a[property], b[property]) } rescue TypeError raise_property_error(property) @@ -416,7 +415,6 @@ module Liquid end elsif ary.all? { |el| el.respond_to?(:[]) } begin - property = Utils.to_s(property) ary.sort { |a, b| nil_safe_casecmp(a[property], b[property]) } rescue TypeError raise_property_error(property) @@ -504,7 +502,6 @@ module Liquid elsif ary.empty? # The next two cases assume a non-empty array. [] else - property = Utils.to_s(property) ary.uniq do |item| item[property] rescue TypeError @@ -536,11 +533,6 @@ module Liquid # @liquid_syntax array | map: string # @liquid_return [array[untyped]] def map(input, property) - property = Utils.to_s(property) - - # Return the input array if property is empty (no-op) - return InputIterator.new(input, context).to_a if property.empty? - InputIterator.new(input, context).map do |e| e = e.call if e.is_a?(Proc) @@ -570,7 +562,6 @@ module Liquid elsif ary.empty? # The next two cases assume a non-empty array. [] else - property = Liquid::Utils.to_s(property) ary.reject do |item| item[property].nil? rescue TypeError @@ -960,8 +951,6 @@ module Liquid # @liquid_syntax array | sum # @liquid_return [number] def sum(input, property = nil) - property = property.nil? ? nil : Utils.to_s(property) - ary = InputIterator.new(input, context) return 0 if ary.empty? diff --git a/lib/liquid/version.rb b/lib/liquid/version.rb index 854073d0..2eee338a 100644 --- a/lib/liquid/version.rb +++ b/lib/liquid/version.rb @@ -2,5 +2,5 @@ # frozen_string_literal: true module Liquid - VERSION = "5.8.4" + VERSION = "5.8.5" end