CLI: make node camera response handling release-safe

This commit is contained in:
Vincent Koc
2026-02-23 00:29:52 -05:00
parent 9b7327bf1e
commit 71d65c6ee5

View File

@@ -106,14 +106,17 @@ export async function writeUrlToFile(
}
: undefined;
const { response: res, release } = await fetchWithSsrFGuard({
url,
auditContext: "writeUrlToFile",
policy,
});
let release: () => Promise<void> = async () => {};
let bytes = 0;
try {
const guarded = await fetchWithSsrFGuard({
url,
auditContext: "writeUrlToFile",
policy,
});
const res = guarded.response;
release = guarded.release;
if (!res.ok) {
throw new Error(`failed to download ${url}: ${res.status} ${res.statusText}`);
}