Skip to content

Commit

Permalink
Fix BackupService crashing when an attachment is missing (mastodon#11241
Browse files Browse the repository at this point in the history
)

* 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
  • Loading branch information
ClearlyClaire committed Jul 14, 2019
1 parent b073008 commit bd77fd6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/services/backup_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,7 @@ def download_to_tar(tar, attachment, filename)
io.write(buffer)
end
end
rescue Errno::ENOENT
Rails.logger.warn "Could not backup file #{filename}: file not found"
end
end

0 comments on commit bd77fd6

Please sign in to comment.