Ensure query exists before returning the sql property

This commit is contained in:
Daniel García Aubert 2019-05-31 12:35:37 +02:00
parent e991511434
commit 3b9f5a523d

View File

@ -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"));