fix(zip): use zipinfo to preflight zip extraction on unix

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-03 17:21:07 +09:00
parent b931e309f4
commit 2288988f28
8 changed files with 336 additions and 185 deletions
@@ -0,0 +1,23 @@
import { spawn } from "bun"
export async function readZipSymlinkTarget(
archivePath: string,
entryPath: string
): Promise<string | undefined> {
const proc = spawn(["unzip", "-p", archivePath, "--", entryPath], {
stdout: "pipe",
stderr: "pipe",
})
const [exitCode, stdout, stderr] = await Promise.all([
proc.exited,
new Response(proc.stdout).text(),
new Response(proc.stderr).text(),
])
if (exitCode !== 0) {
throw new Error(`zip symlink target read failed (exit ${exitCode}): ${stderr}`)
}
return stdout || undefined
}