about summary refs log tree commit diff
path: root/app/services/backup_service.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-07-08 02:24:25 +0200
committermultiple creatures <dev@multiple-creature.party>2020-04-04 12:20:21 -0500
commitc2469539f51c8faf09d7ba020ca2065513fd96cb (patch)
treeb53ea05c1cf63a1cfb30d3e3c79bda36504ae60f /app/services/backup_service.rb
parent3ef5f13ee6baffbec68593c4ddc4f99bfec65201 (diff)
Fix BackupService crashing when an attachment is missing (#11241)
* Fix BackupService crashing when an attachment is missing

For various reasons such as admin error or out-of-sync media and
database backups, it might be possible for local attachments to be lost.

This commit allows the BackupService to continue its work even if some media
file is missing.

* Change error message
Diffstat (limited to 'app/services/backup_service.rb')
-rw-r--r--app/services/backup_service.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/services/backup_service.rb b/app/services/backup_service.rb
index bd9e77223..cc9fb1f4e 100644
--- a/app/services/backup_service.rb
+++ b/app/services/backup_service.rb
@@ -164,5 +164,7 @@ class BackupService < BaseService
         io.write(buffer)
       end
     end
+  rescue Errno::ENOENT
+    Rails.logger.warn "Could not backup file #{filename}: file not found"
   end
 end