mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
FIX: always clean up uploads with no sha1
This commit is contained in:
parent
ddff25d7ff
commit
ba2209f7d7
@ -50,9 +50,11 @@ module Jobs
|
||||
result = result.where("uploads.url NOT IN (?)", ignore_urls) if ignore_urls.present?
|
||||
|
||||
result.find_each do |upload|
|
||||
encoded_sha = Base62.encode(upload.sha1.hex)
|
||||
next if QueuedPost.where("raw LIKE '%#{upload.sha1}%' OR raw LIKE '%#{encoded_sha}%'").exists?
|
||||
next if Draft.where("data LIKE '%#{upload.sha1}%' OR data LIKE '%#{encoded_sha}%'").exists?
|
||||
if upload.sha1.present?
|
||||
encoded_sha = Base62.encode(upload.sha1.hex)
|
||||
next if QueuedPost.where("raw LIKE '%#{upload.sha1}%' OR raw LIKE '%#{encoded_sha}%'").exists?
|
||||
next if Draft.where("data LIKE '%#{upload.sha1}%' OR data LIKE '%#{encoded_sha}%'").exists?
|
||||
end
|
||||
upload.destroy
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user