fix: server get crash in self-hosting

This commit is contained in:
prafull-opensignlabs
2024-11-13 00:33:46 +05:30
parent 4db0d93f41
commit c893d96ad3
3 changed files with 9 additions and 3 deletions
@@ -384,6 +384,7 @@ async function PDF(req) {
isCompleted = true;
}
const randomNumber = Math.floor(Math.random() * 5000);
// below regex is used to replace all word with "_" except A to Z, a to z, numbers
const docName = _resDoc?.Name?.replace(/[^a-zA-Z0-9._-]/g, '_')?.toLowerCase();
const name = `signed_${docName}_${randomNumber}.pdf`;
const filePath = `./exports/${name}`;