From 2343ce1a61bdf0c7bdb78b5a94e05c656f5ca8ec Mon Sep 17 00:00:00 2001 From: Pedro Maximino <53193337+PMax5@users.noreply.github.com> Date: Fri, 31 Mar 2023 14:54:14 +0100 Subject: [PATCH] fix: Check if file exists --- server/resources/file.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/resources/file.js b/server/resources/file.js index ccfacb1..b5b4085 100644 --- a/server/resources/file.js +++ b/server/resources/file.js @@ -282,6 +282,11 @@ async function zipFiles(links) { if (files) { await async.eachSeries(files, async (file) => { log.info({ file: `Processing CV file: ${file.id}` }) + const fileExists = fs.existsSync(`${config.upload.path}/${file.id}`) + if (!fileExists) { + return + } + let link = links.find((link) => { return link.attendee === file.user }) let user = await server.methods.user.get({ 'id': file.user }) let fileData = fs.readFileSync(`${config.upload.path}/${file.id}`)