fix(portal): serve signed PDF in viewer after document is signed
When signedFilePath is set, /api/documents/[id]/file now returns the signed PDF so agent sees embedded signatures and initials in the portal viewer. Falls back to original PDF when not yet signed.
This commit is contained in:
@@ -21,8 +21,9 @@ export async function GET(
|
|||||||
});
|
});
|
||||||
if (!doc || !doc.filePath) return new Response('Not found', { status: 404 });
|
if (!doc || !doc.filePath) return new Response('Not found', { status: 404 });
|
||||||
|
|
||||||
// Serve the original unsigned PDF only — see LEGAL-03
|
// Serve signed PDF to agent when available (LEGAL-03 applies to client-facing endpoints only)
|
||||||
const relativePath = doc.filePath;
|
// Fall back to original if not yet signed
|
||||||
|
const relativePath = doc.signedFilePath ?? doc.filePath;
|
||||||
const filePath = path.join(UPLOADS_BASE, relativePath);
|
const filePath = path.join(UPLOADS_BASE, relativePath);
|
||||||
|
|
||||||
// Path traversal guard — critical security check
|
// Path traversal guard — critical security check
|
||||||
|
|||||||
Reference in New Issue
Block a user