fix: only match dirs when globs if a tail is given

This commit is contained in:
2 * r + 2 * t
2026-06-19 02:40:13 +10:00
parent 8535338e6f
commit 096e583618
+4 -1
View File
@@ -57,7 +57,10 @@ class ManifestEntry:
glob_idx = max(i for i, part in enumerate(parts) if _GLOB_MAGIC.search(part))
pattern = str(Path(*parts[: glob_idx + 1]))
tail = parts[glob_idx + 1 :]
return [Path(match, *tail) for match in sorted(glob.glob(pattern))]
matches = sorted(glob.glob(pattern))
if tail: # Only match dirs if a tail exists
matches = [match for match in matches if Path(match).is_dir()]
return [Path(match, *tail) for match in matches]
@dataclass(frozen=True)