fix viewimg 404 status
This commit is contained in:
parent
bcc4b1ed7d
commit
0cd5667f63
6
app.js
6
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))
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user