From 03bb7f23d6b9bb86e96e68003c9c6333901ffb7b Mon Sep 17 00:00:00 2001 From: CapacitorSet Date: Thu, 22 Mar 2018 18:16:30 +0100 Subject: [PATCH] Return empty object for missing urls.json/etc in API server --- integrations/api/api.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integrations/api/api.js b/integrations/api/api.js index d40a12c..407175f 100644 --- a/integrations/api/api.js +++ b/integrations/api/api.js @@ -280,7 +280,7 @@ app.get("/sample/:id/urls", async (req, res) => { const file = path.join(outputFolder, "sample.js.results", "urls.json"); if (!await p(fs.exists)(file)) { - res.json({server_err: 3}); + res.send("[]"); return; } @@ -308,7 +308,7 @@ app.get("/sample/:id/resources", async (req, res) => { const file = path.join(outputFolder, "sample.js.results", "resources.json"); if (!await p(fs.exists)(file)) { - res.json({server_err: 3}); + res.send("{}"); return; } @@ -336,7 +336,7 @@ app.get("/sample/:id/snippets", async (req, res) => { const file = path.join(outputFolder, "sample.js.results", "snippets.json"); if (!await p(fs.exists)(file)) { - res.json({server_err: 3}); + res.send("[]"); return; } @@ -364,7 +364,7 @@ app.get("/sample/:id/ioc", async (req, res) => { const file = path.join(outputFolder, "sample.js.results", "IOC.json"); if (!await p(fs.exists)(file)) { - res.json({server_err: 3}); + res.send("[]"); return; }