admin docs: verify object existence, mark dead links, cleaner 404
The DB can record a pdf_minio_path before the object is uploaded (e.g. a prepared-filing path written for an order whose prep never completed -- Paul Wilson / Mark Adams MCS-150s). The documents list now HEAD-checks each key and returns an exists flag; the UI shows 'not generated yet' instead of a dead View button, and the stream endpoint returns a clean 404 for a missing object.
This commit is contained in:
parent
bce5db4a09
commit
1f3b36b29e
2 changed files with 23 additions and 4 deletions
|
|
@ -386,12 +386,13 @@
|
|||
box.innerHTML = documents.map((d) => {
|
||||
const u = API + "/api/v1/admin/compliance-orders/" + encodeURIComponent(orderNumber)
|
||||
+ "/document?key=" + encodeURIComponent(d.key) + "&token=" + tok;
|
||||
const action = (d.exists === false)
|
||||
? `<span class="small" style="color:#9ca3af;">not generated yet</span>`
|
||||
: `<a href="${u}" target="_blank" rel="noopener" class="btn btn-blue btn-sm" style="text-decoration:none;">View</a>`;
|
||||
return `<div class="svc-row"><div class="svc-left">
|
||||
<span style="font-size:13px;">${esc(d.label)}</span>
|
||||
<span class="small">${esc(d.key.split("/").pop())}</span>
|
||||
</div><div class="svc-right">
|
||||
<a href="${u}" target="_blank" rel="noopener" class="btn btn-blue btn-sm" style="text-decoration:none;">View</a>
|
||||
</div></div>`;
|
||||
</div><div class="svc-right">${action}</div></div>`;
|
||||
}).join("");
|
||||
} catch (e) {
|
||||
box.innerHTML = `<div style="color:#b91c1c;font-size:12px;">Could not load documents: ${esc(e.message)}</div>`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue