fix(reference): refuse undecodable Git directory pointers (#12209)

This commit is contained in:
ShuaixinHuang authored and GitHub committed 2026-11-19 06:34:36 -05:00
1 parent 845e72ea5a
commit 1a89383a79
2 files changed
+50 -1

No files matched your search

+2 -1
View File
@@ -1,3 +1,4 @@
import { decodeStrictUtf8 } from "../domain/strictUtf8.js";
import { isAborted } from "../domain/analysisErrorCore.js";
import fs from "node:fs";
import { join } from "node:path";
@@ -142,7 +143,7 @@ const resolveSourceVcs = async (
}
};
const readMetadataText = async (path: string): Promise<string> =>
(await readMetadataBytes(path)).toString("utf8");
decodeStrictUtf8(await readMetadataBytes(path), "preserve");
const throwCleanupFailures = (primary: unknown): never => {
const observations = cleanupFailures.flatMap((failure) =>
failure.cleanup === undefined ? [] : [failure.cleanup],