uploads: fix exception when pruning expired uploads.
Hourly pruning of expired uploads was failing because of nil deference errors in `media_asset.destroy!`. There are various cases where an upload doesn't have a media asset, for example when the source url fails to download or when the upload is of an invalid filetype.
This commit is contained in:
@@ -115,7 +115,7 @@ class Upload < ApplicationRecord
|
||||
return
|
||||
end
|
||||
|
||||
media_asset.destroy!
|
||||
media_asset&.destroy!
|
||||
DanbooruLogger.info("Uploads: Deleting files for upload md5=#{md5}")
|
||||
Danbooru.config.storage_manager.delete_file(nil, md5, file_ext, :original)
|
||||
Danbooru.config.storage_manager.delete_file(nil, md5, file_ext, :large)
|
||||
|
||||
Reference in New Issue
Block a user