Fix case-insensitive matching for manual meta_data_filter in / not in list values (#14397)

## Summary

Fixes case-asymmetric matching for manual `meta_data_filter` when using
**`in`** / **`not in`** with a **list** `value`. Document metadata
strings were lowercased, but list elements were not, so values like
`"F2"` failed to match `["F2", "F11"]` even though **`=`** behaved
correctly.

Closes #14389

## Changes

- **`common/metadata_utils.py`**: For **`in`** / **`not in`**, normalize
string elements when `value` and/or `input` is a list, consistent with
scalar string lowercasing.
- **`test/unit_test/common/test_metadata_filter_operators.py`**:
Regression tests for list `value` case-insensitivity and **`not in`**.

## Type of change

- [x] Bug fix (non-breaking)
This commit is contained in:
NeedmeFordev
2026-04-28 08:51:48 +02:00
committed by GitHub
parent 2a37562791
commit 0df65d358a

View File

@ -98,8 +98,12 @@ def meta_filter(metas: dict, filters: list[dict], logic: str = "and"):
# Non-comparison operators: maintain original logic
if isinstance(input, str):
input = input.lower()
elif operator in ("in", "not in") and isinstance(input, list):
input = [x.lower() if isinstance(x, str) else x for x in input]
if isinstance(value, str):
value = value.lower()
elif operator in ("in", "not in") and isinstance(value, list):
value = [x.lower() if isinstance(x, str) else x for x in value]
matched = False
try: