0

I am currently using extract-zip to unzip the zip files uploaded to the server in my project. I am trying to catch the error that throws when extracting zip files with invalid file names. But it crashes the server when a zip file is uploaded with invalid file paths like paths containing back slashes.

My code is as follows;

extract(filePath, { dir: extractFiledir }, function (err) {
                if (err) {
                  logger.error("[menu_service] :: importCourse() : error ::" + err);
                  return res.status(500).json({ status: { code: 500, name: i18n.__('Error'), message: i18n.__('Error') }, payload: null });
                } else {
                 //if successfully extracted
                  }
});

It doesn't catch the error instead it crashes the server without returning the response.

WLVF
  • 1

0 Answers0