Skip to content

Commit

Permalink
DEV: Do not delete failed uploads from S3 in debug mode (#14143)
Browse files Browse the repository at this point in the history
See also 58e9fff
  • Loading branch information
martin-brennan committed Aug 25, 2021
1 parent d2fe46d commit a7ec1a8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/services/external_upload_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,11 @@ def promote_to_upload!
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])
Expand Down

0 comments on commit a7ec1a8

Please sign in to comment.