Remove media attachment only when file was exist (#25586)

pull/62/head
S.H 2023-06-26 23:38:19 +09:00 committed by GitHub
parent bb4756c823
commit 7a25af64dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -64,7 +64,7 @@ class AttachmentBatch
keys << attachment.style_name_as_path(style) keys << attachment.style_name_as_path(style)
when :filesystem when :filesystem
logger.debug { "Deleting #{attachment.path(style)}" } logger.debug { "Deleting #{attachment.path(style)}" }
FileUtils.remove_file(attachment.path(style)) FileUtils.remove_file(attachment.path(style), true)
when :fog when :fog
logger.debug { "Deleting #{attachment.path(style)}" } logger.debug { "Deleting #{attachment.path(style)}" }
attachment.directory.files.new(key: attachment.path(style)).destroy attachment.directory.files.new(key: attachment.path(style)).destroy