DEV: Do not delete failed uploads from S3 in debug mode (#14143)

See also 58e9fffe4c
This commit is contained in:
Martin Brennan 2021-08-25 15:35:55 +10:00 committed by GitHub
parent d2fe46d476
commit a7ec1a86b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,12 +84,11 @@ class ExternalUploadManager
external_upload_stub.created_by_id
)
rescue
# We don't need to do anything special to abort multipart uploads here,
# because at this point (calling promote_to_upload!), the multipart
# upload would already be complete.
Discourse.store.delete_file(external_upload_stub.key)
if !SiteSetting.enable_upload_debug_mode
# We don't need to do anything special to abort multipart uploads here,
# because at this point (calling promote_to_upload!), the multipart
# upload would already be complete.
Discourse.store.delete_file(external_upload_stub.key)
external_upload_stub.destroy!
else
external_upload_stub.update(status: ExternalUploadStub.statuses[:failed])