Update error messages for uploads

This commit is contained in:
Pavel Djundik 2019-08-25 20:14:34 +03:00
parent aadfede911
commit 16d070c19e

View file

@ -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,