fix(artifacts): admit bounded reads and preserve source identity
Validation: integrated changes passed formatting, typecheck, lint, resolved module-boundary verification and git diff --check. Tests and real-provider workflows were not run.
This commit is contained in:
@@ -147,29 +147,28 @@ export const inspectBundleKeyedArchive = async (input: {
|
||||
try {
|
||||
// Match inventory spelling while retaining the raw path for I/O and evidence.
|
||||
const wanted = selected.path.normalize("NFC");
|
||||
const matches: ArtifactEntry[] = [];
|
||||
for await (const entry of reader.entries(input.signal, (directory) =>
|
||||
let entry: ArtifactEntry | undefined;
|
||||
for await (const candidate of reader.entries(input.signal, (directory) =>
|
||||
wanted.startsWith(`${directory.normalize("NFC")}/`),
|
||||
)) {
|
||||
if (entry.path.normalize("NFC") !== wanted) continue;
|
||||
if (entry.kind !== "file")
|
||||
if (candidate.path.normalize("NFC") !== wanted) continue;
|
||||
if (candidate.kind !== "file")
|
||||
throw archivePathError(
|
||||
"invalid_value",
|
||||
`Archive path selects a ${entry.kind}, not a regular file: ${selected.path}`,
|
||||
`Archive path selects a ${candidate.kind}, not a regular file: ${selected.path}`,
|
||||
);
|
||||
if ((entry.declaredSize ?? 0) > MAX_BYTES)
|
||||
if ((candidate.declaredSize ?? 0) > MAX_BYTES)
|
||||
throw new ArtifactReaderFailure(
|
||||
"limit",
|
||||
"Keyed archive exceeds 64 MiB",
|
||||
);
|
||||
matches.push(entry);
|
||||
if (entry !== undefined)
|
||||
throw archivePathError(
|
||||
"invalid_value",
|
||||
`Archive path matches multiple Unicode-equivalent bundle entries; selection is ambiguous: ${selected.path}`,
|
||||
);
|
||||
entry = candidate;
|
||||
}
|
||||
if (matches.length > 1)
|
||||
throw archivePathError(
|
||||
"invalid_value",
|
||||
`Archive path matches ${String(matches.length)} Unicode-equivalent bundle entries; selection is ambiguous: ${selected.path}`,
|
||||
);
|
||||
const entry = matches[0];
|
||||
if (entry === undefined)
|
||||
throw archivePathError(
|
||||
"invalid_value",
|
||||
|
||||
Reference in New Issue
Block a user