Follow up to 149411ec90ad443cc662b7ef307ce76f83a774e1.

diff --git a/app/models/upload.rb b/app/models/upload.rb
index b68fa53..5c711a7 100644
--- a/app/models/upload.rb
+++ b/app/models/upload.rb
@@ -266,12 +266,15 @@ class Upload < ActiveRecord::Base
           )
 
           remap_scope ||= begin
-            Post.with_deleted.where("raw ~ '/uploads/default/\\d+/'").all
+            Post.with_deleted
+              .where("raw ~ '/uploads/default/\\d+/'")
+              .select(:raw, :cooked)
+              .all
           end
 
           remap_scope.each do |post|
             post.raw.gsub!(previous_url, upload.url)
-            post.cooked.sub!(previous_url, upload.url)
+            post.cooked.gsub!(previous_url, upload.url)
             post.save! if post.changed?
           end

GitHub sha: 3094a603

2 Likes