uploads: consider uploads as failed when all assets fail.
Make the "completed" status for an upload mean "at least one file in the upload successfully completed". The "error" status means "all files in the upload failed". This means that when an upload has multiple assets and some succeed and some fail, the whole upload is considered completed. This can happen when uploading multiple files and some files are over the size limit, for example. The upload is considered failed only if all files in the upload fail. This fixes an issue where, if uploading a single file and that file failed because it was over the size limit, then the upload wouldn't be marked as failed.
This commit is contained in:
@@ -101,7 +101,13 @@ export default class FileUploadComponent {
|
||||
upload = await $.get(`/uploads/${upload.id}.json`);
|
||||
}
|
||||
|
||||
if (upload.media_asset_count > 0) {
|
||||
if (upload.status === "error") {
|
||||
this.$dropzone.removeClass("success");
|
||||
this.$component.find("progress").addClass("hidden");
|
||||
this.$component.find("input").removeAttr("disabled");
|
||||
|
||||
Utility.error(`Upload failed: ${upload.error}.`);
|
||||
} else {
|
||||
let params = new URLSearchParams(window.location.search);
|
||||
let isBookmarklet = params.has("url");
|
||||
params.delete("url");
|
||||
@@ -115,12 +121,6 @@ export default class FileUploadComponent {
|
||||
} else {
|
||||
window.location.assign(url);
|
||||
}
|
||||
} else if (upload.status === "error") {
|
||||
this.$dropzone.removeClass("success");
|
||||
this.$component.find("progress").addClass("hidden");
|
||||
this.$component.find("input").removeAttr("disabled");
|
||||
|
||||
Utility.error(`Upload failed: ${upload.error}.`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user