fix(cleanup files fix5)

This commit is contained in:
2025-10-04 00:19:57 +05:30
parent 11d7c3015e
commit f0657e78f2
2 changed files with 130 additions and 100 deletions

View File

@@ -280,8 +280,21 @@ router.post(
}
// Clean up temp files:
if (result.ss_path) {
await emptyFolderContainingFile(result.ss_path);
// call cleaner on best known path and log
const cleanupPath =
result?.ss_path || generatedPdfPath || result?.pdf_path;
console.log(
"[claim-status-check] calling emptyFolderContainingFile for:",
cleanupPath
);
if (cleanupPath) {
try {
await emptyFolderContainingFile(cleanupPath);
} catch (cleanupErr) {
console.error("[claim-status-check] cleanup error:", cleanupErr);
}
} else {
console.log("[claim-status-check] no cleanup path available");
}
result.pdfUploadStatus = `PDF saved to group: ${group.title}`;