fix(artifacts): budget full namespaces and retain directory contradictions

This commit is contained in:
morluto
2026-10-08 21:04:39 +08:00
parent 3e9d38ccd8
commit 31570a22fb
7 changed files with 120 additions and 12 deletions
+10 -5
View File
@@ -231,6 +231,11 @@ const collectMembers = (
const type = textOf(next.element, "type")?.trim();
const mode = xarMode(textOf(next.element, "mode"));
const { kind, unsupportedType } = classifyMemberType(type);
if (kind !== "file" && childElement(next.element, "data") !== undefined)
throw new ArtifactReaderFailure(
"format",
`xar non-file member declares data: ${path}`,
);
members.push({
path,
kind,
@@ -239,11 +244,11 @@ const collectMembers = (
data: parseData(next.element),
link: kind === "symlink" ? textOf(next.element, "link") : undefined,
});
pending.push(
...childElements(next.element, "file")
.map((element) => ({ element, parent: path }))
.reverse(),
);
const children = childElements(next.element, "file");
for (let index = children.length - 1; index >= 0; index--) {
const element = children[index];
if (element !== undefined) pending.push({ element, parent: path });
}
}
return members;
};