mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:23:25 +08:00
FIX: don't raise an error if file not found in S3. (#17841)
While deleting the object in S3, don't raise an error if the file is not available in S3. Co-authored-by: Régis Hanol <regis@hanol.fr>
This commit is contained in:
parent
d5dc4ca0e9
commit
169f2ad443
|
@ -97,12 +97,12 @@ class S3Helper
|
|||
# delete the file
|
||||
s3_filename.prepend(multisite_upload_path) if Rails.configuration.multisite
|
||||
delete_object(get_path_for_s3_upload(s3_filename))
|
||||
rescue Aws::S3::Errors::NoSuchKey
|
||||
rescue Aws::S3::Errors::NoSuchKey, Aws::S3::Errors::NotFound
|
||||
end
|
||||
|
||||
def delete_object(key)
|
||||
s3_bucket.object(key).delete
|
||||
rescue Aws::S3::Errors::NoSuchKey
|
||||
rescue Aws::S3::Errors::NoSuchKey, Aws::S3::Errors::NotFound
|
||||
end
|
||||
|
||||
def copy(source, destination, options: {})
|
||||
|
|
Loading…
Reference in New Issue
Block a user