From 0cd5667f639381dc52c86cc760ea3a5ea7a9a3a0 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 5 May 2017 10:45:44 +0800 Subject: [PATCH] fix viewimg 404 status --- app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 6e4fc79..835a54e 100644 --- a/app.js +++ b/app.js @@ -66,7 +66,7 @@ app.get('/camevent', (req, res) => { app.get('/viewcamimg/:dir/:img', async(req, res) => { let dir = req.params.dir; let img = req.params.img; - if (!dir || !img) return res.status(404).end(); + if (!dir || !img) return res.sendStatus(404); try { let stat = await new Promise((resolve, reject) => { fs.stat(path.resolve(config.cmdpath.ipcamsave, dir, img), (err, stats) => { @@ -74,9 +74,9 @@ app.get('/viewcamimg/:dir/:img', async(req, res) => { return resolve(stats); }) }) - if (!stat.isFile()) return res.status(404).end(); + if (!stat.isFile()) return res.sendStatus(404); } catch (e) { - return res.status(404).end(); + return res.sendStatus(404); } res.sendfile(path.resolve(config.cmdpath.ipcamsave, dir, img)) })