From d364034738da783d7f660d457db3fc2dc67239e7 Mon Sep 17 00:00:00 2001 From: Bobby Date: Wed, 28 Sep 2022 11:37:29 +0700 Subject: [PATCH] fix: improve url uploads input check --- controllers/uploadController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/uploadController.js b/controllers/uploadController.js index 8e05dd3..31a160e 100644 --- a/controllers/uploadController.js +++ b/controllers/uploadController.js @@ -551,8 +551,8 @@ self.actuallyUploadUrls = async (req, res, data = {}) => { } const urls = req.body.urls - if (!urls || !(urls instanceof Array)) { - throw new ClientError('Missing "urls" property (array).') + if (!Array.isArray(urls) || !urls.length || urls.some(url => !/^https?:\/\//.test(url))) { + throw new ClientError('Bad request.') } if (urls.length > maxFilesPerUpload) {