From 3b9f5a523d018dab45938979a110883554dbb078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Fri, 31 May 2019 12:35:37 +0200 Subject: [PATCH] Ensure query exists before returning the sql property --- app/controllers/copy_controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/copy_controller.js b/app/controllers/copy_controller.js index ff188246..a1e3cf75 100644 --- a/app/controllers/copy_controller.js +++ b/app/controllers/copy_controller.js @@ -185,7 +185,7 @@ function getFilenameParam () { function validateCopyQuery () { return function validateCopyQueryMiddleware (req, res, next) { - const sql = req.query.q || (req.body && req.body.q); + const sql = (req.query && req.query.q) || (req.body && req.body.q); if (!sql) { return next(new Error("SQL is missing"));