admin docs: probe existence with ranged GET (HEAD fails presigned-URL sig)
This commit is contained in:
parent
1f3b36b29e
commit
aa498fdfdf
1 changed files with 5 additions and 2 deletions
|
|
@ -676,8 +676,11 @@ router.get("/api/v1/admin/compliance-orders/:order_number/documents", requireAdm
|
|||
try {
|
||||
const url = await presignInternal(d.key);
|
||||
if (url) {
|
||||
const head = await fetch(url, { method: "HEAD" });
|
||||
present = head.ok;
|
||||
// The presigned URL is signed for GET, so a HEAD request fails the
|
||||
// signature check. Use a 1-byte ranged GET to confirm existence
|
||||
// cheaply without downloading the whole object.
|
||||
const probe = await fetch(url, { headers: { Range: "bytes=0-0" } });
|
||||
present = probe.ok; // 200 or 206
|
||||
}
|
||||
} catch { /* treat as missing */ }
|
||||
return { ...d, exists: present };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue