Parse only explicit manifest paths
This commit is contained in:
@@ -143,6 +143,23 @@ def _iter_strings(value: Any) -> Iterable[str]:
|
||||
yield from _iter_strings(nested)
|
||||
|
||||
|
||||
def _iter_manifest_path_values(value: Any, parent_key: str = "") -> Iterable[str]:
|
||||
path_tokens = ("path", "file", "artifact", "manifest", "output")
|
||||
if isinstance(value, dict):
|
||||
for key, nested in value.items():
|
||||
normalized_key = str(key).strip().lower()
|
||||
if isinstance(nested, str) and any(token in normalized_key for token in path_tokens):
|
||||
yield nested
|
||||
else:
|
||||
yield from _iter_manifest_path_values(nested, normalized_key)
|
||||
elif isinstance(value, (list, tuple)):
|
||||
for nested in value:
|
||||
if isinstance(nested, str) and any(token in parent_key for token in path_tokens):
|
||||
yield nested
|
||||
else:
|
||||
yield from _iter_manifest_path_values(nested, parent_key)
|
||||
|
||||
|
||||
def normalize_storage_reference(value: str | None, storage_root: Path) -> Path | None:
|
||||
if not value:
|
||||
return None
|
||||
@@ -182,7 +199,7 @@ def expand_manifest_references(references: set[Path], storage_root: Path) -> set
|
||||
payload = json.loads(manifest.read_text(encoding="utf-8"))
|
||||
except (OSError, UnicodeDecodeError, json.JSONDecodeError):
|
||||
continue
|
||||
for value in _iter_strings(payload):
|
||||
for value in _iter_manifest_path_values(payload):
|
||||
normalized = normalize_storage_reference(value, root)
|
||||
if normalized is None and "://" not in value:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user