]> cat aescling's git repositories - mastodon.git/commitdiff
Fix BackupService crashing when an attachment is missing (#11241)
authorThibG <thib@sitedethib.com>
Mon, 8 Jul 2019 00:24:25 +0000 (02:24 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 8 Jul 2019 00:24:25 +0000 (02:24 +0200)
* 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

app/services/backup_service.rb

index 4cfa22ab893604277313a921bc1c208de4092c2f..12e4fa8b441ccccac5dfd91a6422239421b87655 100644 (file)
@@ -142,5 +142,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