From a7ec1a86b5108f47ed4cd801048d243ed1c60f7b Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Wed, 25 Aug 2021 15:35:55 +1000 Subject: [PATCH] DEV: Do not delete failed uploads from S3 in debug mode (#14143) See also 58e9fffe4cd0156284257c64306a6af0133367e0 --- app/services/external_upload_manager.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/services/external_upload_manager.rb b/app/services/external_upload_manager.rb index dceebe0ded2..d08cee65fdf 100644 --- a/app/services/external_upload_manager.rb +++ b/app/services/external_upload_manager.rb @@ -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])