From 42f07bc1f3f64a63ce7dec0bf22a4a1e5bdbd42f Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 1 Sep 2025 00:58:11 +0200 Subject: [PATCH] Fix: fix tests --- src/Logic/Tags/TagUtils.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Logic/Tags/TagUtils.ts b/src/Logic/Tags/TagUtils.ts index e4aba8209..03f9a7f0a 100644 --- a/src/Logic/Tags/TagUtils.ts +++ b/src/Logic/Tags/TagUtils.ts @@ -1006,15 +1006,18 @@ export class TagUtils { * Returns a similarly structured tag, but all tags with an empty value are removed. * Those are assumed to be all met (and thus true) * - * new And([new Tag("a", "b"), new Tag("c", "")] // => new Tag("a","b") - * new And([new Tag("c", "")] // => true + * TagUtils.removeEmptyParts(new And([new Tag("a", "b"), new Tag("c", "")])) // => new Tag("a","b") + * TagUtils.removeEmptyParts(new And([new Tag("c", "")])) // => true */ public static removeEmptyParts(tag: UploadableTag): UploadableTag | true { if (tag["and"]) { const tags = tag["and"] const cleaned = tags.map(t => TagUtils.removeEmptyParts(t)) const filtered = cleaned.filter(t => t !== true) - return new And(filtered) + if (filtered.length === 0) { + return true + } + return new And(filtered).optimize() } if (tag.isNegative()) { return true