From a9c1dd01807c93ed42ba820bc16131fef7619ad2 Mon Sep 17 00:00:00 2001 From: Varghese Thomas Date: Fri, 11 Aug 2017 20:52:18 +0530 Subject: [PATCH] Replacing all send status 404 with notfound page --- server/server.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/server.js b/server/server.js index 4e6361b3..2579b4ee 100644 --- a/server/server.js +++ b/server/server.js @@ -133,7 +133,7 @@ app.get('/jsconfig.js', (req, res) => { app.get('/exists/:id', async (req, res) => { const id = req.params.id; if (!validateID(id)) { - res.sendStatus(404); + res.status(404).render('notfound'); return; } @@ -141,7 +141,7 @@ app.get('/exists/:id', async (req, res) => { await storage.exists(id); res.sendStatus(200); } catch (e) { - res.sendStatus(404); + res.status(404).render('notfound'); } }); @@ -172,7 +172,7 @@ app.get('/download/:id', async (req, res) => { app.get('/assets/download/:id', async (req, res) => { const id = req.params.id; if (!validateID(id)) { - res.sendStatus(404); + res.status(404).render('notfound'); return; } @@ -197,7 +197,7 @@ app.get('/assets/download/:id', async (req, res) => { file_stream.pipe(res); } catch (e) { - res.sendStatus(404); + res.status(404).render('notfound'); } }); @@ -205,14 +205,14 @@ app.post('/delete/:id', async (req, res) => { const id = req.params.id; if (!validateID(id)) { - res.sendStatus(404); + res.status(404).render('notfound'); return; } const delete_token = req.body.delete_token; if (!delete_token) { - res.sendStatus(404); + res.status(404).render('notfound'); return; } @@ -222,7 +222,7 @@ app.post('/delete/:id', async (req, res) => { res.sendStatus(200); } } catch (e) { - res.sendStatus(404); + res.status(404).render('notfound'); } }); @@ -242,7 +242,7 @@ app.post('/upload', (req, res, next) => { !meta.hasOwnProperty('filename') || !validateIV(meta.id) ) { - res.sendStatus(404); + res.status(404).render('notfound'); return; }