From 16d070c19e29f0242c10bd35c5d37b1a33de0a7a Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 25 Aug 2019 20:14:34 +0300 Subject: [PATCH] Update error messages for uploads --- src/plugins/uploader.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/uploader.js b/src/plugins/uploader.js index f7d19870..cc2eda68 100644 --- a/src/plugins/uploader.js +++ b/src/plugins/uploader.js @@ -122,7 +122,7 @@ class Uploader { // if the authentication token is incorrect, bail out if (uploadTokens.delete(req.params.token) !== true) { - return abortWithError(Error("Unauthorized")); + return abortWithError(Error("Invalid upload token")); } // if the request does not contain any body data, bail out @@ -198,6 +198,10 @@ class Uploader { busboyInstance.on("finish", () => { doneCallback(); + if (!uploadUrl) { + return res.status(400).json({error: "Missing file"}); + } + // upload was done, send the generated file url to the client res.status(200).json({ url: uploadUrl,