fix: address CodeRabbit review feedback

- Handle Headers instance in TSA request detection (not just plain objects)
- Wrap timestampPdf with createCorsAwareFetch for OCSP/cert chain requests
- Pass 'success' type to showAlert on successful timestamp
- Add TSA URL context to timestamp error messages with cause
- Remove redundant Uint8Array wrapping in TimestampNode
This commit is contained in:
InstalZDLL
2026-03-15 00:46:47 +01:00
parent dfd0ebcfc5
commit 70f0834fc0
3 changed files with 25 additions and 10 deletions

View File

@@ -43,9 +43,15 @@ export class TimestampNode extends BaseWorkflowNode {
return {
pdf: await processBatch(pdfInputs, async (input) => {
const timestampedBytes = await timestampPdf(input.bytes, tsaUrl);
const bytes = new Uint8Array(timestampedBytes);
let bytes: Uint8Array;
try {
bytes = await timestampPdf(input.bytes, tsaUrl);
} catch (err) {
throw new Error(
`Failed to timestamp using TSA ${tsaUrl}: ${err instanceof Error ? err.message : err}`,
{ cause: err }
);
}
const document = await PDFDocument.load(bytes);
return {