diff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rake index 55e17d07b70..2fa4a110e20 100644 --- a/lib/tasks/uploads.rake +++ b/lib/tasks/uploads.rake @@ -1092,6 +1092,16 @@ def fix_missing_s3 # we do not fix sha, it may be wrong for arbitrary reasons, if we correct it # we may end up breaking posts upload.update!(etag: fixed_upload.etag, url: fixed_upload.url, verified: nil) + + OptimizedImage.where(upload_id: upload.id).destroy_all + rebake_ids = PostUpload.where(upload_id: upload.id).pluck(:post_id) + + if rebake_ids.present? + Post.where(id: rebake_ids).each do |post| + puts "rebake post #{post.id}" + post.rebake! + end + end end end