Update error messages for uploads
This commit is contained in:
parent
aadfede911
commit
16d070c19e
@ -122,7 +122,7 @@ class Uploader {
|
|||||||
|
|
||||||
// if the authentication token is incorrect, bail out
|
// if the authentication token is incorrect, bail out
|
||||||
if (uploadTokens.delete(req.params.token) !== true) {
|
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
|
// if the request does not contain any body data, bail out
|
||||||
@ -198,6 +198,10 @@ class Uploader {
|
|||||||
busboyInstance.on("finish", () => {
|
busboyInstance.on("finish", () => {
|
||||||
doneCallback();
|
doneCallback();
|
||||||
|
|
||||||
|
if (!uploadUrl) {
|
||||||
|
return res.status(400).json({error: "Missing file"});
|
||||||
|
}
|
||||||
|
|
||||||
// upload was done, send the generated file url to the client
|
// upload was done, send the generated file url to the client
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
url: uploadUrl,
|
url: uploadUrl,
|
||||||
|
Loading…
Reference in New Issue
Block a user