fix: prune matched media collection roots

This commit is contained in:
Mikei386
2026-08-24 12:15:59 +02:00
parent d50df78441
commit b4b83c2797
7 changed files with 21 additions and 11 deletions
+7 -1
View File
@@ -307,7 +307,13 @@ function files_inventory(
break 2;
}
}
if ($is_dir) $queue[] = [$full, $relative, $depth + 1];
// A filtered discovery call is meant to locate collection roots.
// Once a directory itself matches, return that root but do not also
// flood the bounded result with matching descendants. A follow-up
// call with this path and an empty filter inventories the collection.
if ($is_dir && !($needle !== '' && $matches)) {
$queue[] = [$full, $relative, $depth + 1];
}
}
}