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 authored and hiyuki2578 committed Oct 2, 2019
1 parent 5490150 commit 04911b4
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 @@ -142,5 +142,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 04911b4

Please sign in to comment.