DEV: Do not abort direct S3 uploads if upload_debug_mode enabled (#14141)

See the previous commit d66b258b0e as
well.

If enable_upload_debug_mode is true, we do not want to abort the
direct S3 upload, because that will delete the file on S3 and prevent
further inspection of any errors that have come up.
This commit is contained in:
Martin Brennan 2021-08-25 14:48:06 +10:00 committed by GitHub
parent 419d71abcb
commit 58e9fffe4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -239,6 +239,8 @@ export default Mixin.create({
this._inProgressUploads--;
this._resetUpload(file, { removePlaceholder: true });
file.meta.error = error;
if (!this.userCancelled) {
displayErrorForUpload(response || error, this.siteSettings, file.name);
this.appEvents.trigger("composer:upload-error", file);
@ -433,6 +435,13 @@ export default Mixin.create({
return;
}
// this gives us a chance to inspect the upload stub before
// it is deleted from external storage by aborting the multipart
// upload; see also ExternalUploadManager
if (file.meta.error && self.siteSettings.enable_upload_debug_mode) {
return;
}
return ajax("/uploads/abort-multipart.json", {
type: "POST",
data: {

View File

@ -283,6 +283,7 @@ basic:
enable_upload_debug_mode:
default: false
hidden: true
client: true
default_theme_id:
default: -1
hidden: true