fix(apple): retain caller-selected cache path in results

This commit is contained in:
morluto
2026-10-08 16:51:39 +08:00
parent dbc7ebc2b6
commit 92fcab2c68
@@ -96,7 +96,10 @@ export const inspectDyldSharedCache = async (
const parsed = inspectDyldSharedCacheInputSchema.safeParse(rawInput); const parsed = inspectDyldSharedCacheInputSchema.safeParse(rawInput);
if (!parsed.success) if (!parsed.success)
return err(new AnalysisInputError(OPERATION, { cause: parsed.error })); return err(new AnalysisInputError(OPERATION, { cause: parsed.error }));
const cachePath = resolve(parsed.data.cache_path); // Keep the caller-selected spelling for result and Evidence metadata; only
// filesystem access uses the resolved path.
const selectedPath = parsed.data.cache_path;
const cachePath = resolve(selectedPath);
let cache: DyldSharedCache | undefined; let cache: DyldSharedCache | undefined;
try { try {
cache = await DyldSharedCache.open(cachePath, signal); cache = await DyldSharedCache.open(cachePath, signal);
@@ -114,7 +117,7 @@ export const inspectDyldSharedCache = async (
const subcacheSha = await cache.subcacheSha256(signal); const subcacheSha = await cache.subcacheSha256(signal);
return ok( return ok(
dyldSharedCacheResultSchema.parse({ dyldSharedCacheResultSchema.parse({
cache_path: cachePath, cache_path: selectedPath,
// The header and image list were read through this same handle. // The header and image list were read through this same handle.
main_file_sha256: mainSha, main_file_sha256: mainSha,
...cache.header, ...cache.header,