From e6bb94692b0e06907c71137d9cf1f67aa25ec15b Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Sun, 4 Aug 2019 06:42:35 +0700 Subject: [PATCH] Oversights --- controllers/uploadController.js | 4 ++-- controllers/utilsController.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/controllers/uploadController.js b/controllers/uploadController.js index 875a305..9067f0b 100644 --- a/controllers/uploadController.js +++ b/controllers/uploadController.js @@ -489,14 +489,14 @@ uploadsController.cleanUpChunks = async (uuidDir, chunkNames) => { )) return new Promise((resolve, reject) => { fs.rmdir(uuidDir, error => { - if (error) reject(error) + if (error) return reject(error) resolve(true) }) }) } uploadsController.formatInfoMap = (req, res, user, infoMap) => { - return new Promise((resolve, reject) => { + return new Promise(resolve => { let iteration = 0 const files = [] const existingFiles = [] diff --git a/controllers/utilsController.js b/controllers/utilsController.js index 5174897..79eb264 100644 --- a/controllers/utilsController.js +++ b/controllers/utilsController.js @@ -336,7 +336,7 @@ utilsController.bulkDeleteFiles = async (field, values, user, set) => { deletedFiles.forEach(file => { const identifier = file.name.split('.')[0] set.delete(identifier) - // console.log(`Removed ${identifier} from identifiers cache (bulkDeleteFiles)`) + // console.log(`Removed ${identifier} from identifiers cache (bulkDeleteFiles)`) }) // Update albums if necessary @@ -362,7 +362,7 @@ utilsController.bulkDeleteFiles = async (field, values, user, set) => { }) return resolve() - }) + }).catch(console.error) })) return failed }