Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-8484

"contains" Liquid operator behaves unexpectedly on arrays

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.14.0 GA
    • 2.11.3 GA
    • Gateway
    • False
    • None
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • +
    • Hide

      In any policy that renders Liquid, use the following snippet:

      {% assign arr = "abcd afooa efghi" | split: " " %}{% if arr contains "foo" %}yes{% else %}no{% endif%}
      

      And confirm it returns yes while we would be expecting no.

      Show
      In any policy that renders Liquid, use the following snippet: {% assign arr = "abcd afooa efghi" | split: " " %}{% if arr contains "foo" %}yes{% else %}no{% endif%} And confirm it returns yes while we would be expecting no .

      When the "contains" operator is applied to arrays, it parses the array looking for any element that contains the given pattern as a substring, rather than looking for exact matches, for example, the snippet in the steps to reproduce returns a match whereas we would expect it to not find the pattern among the elements in the array.

              Unassigned Unassigned
              rhn-support-sillumin Samuele Illuminati (Inactive)
              Marian Ganisin Marian Ganisin (Inactive)
              Eguzki Astiz Lezaun Eguzki Astiz Lezaun
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: