A platform for community discussion. Free, open, simple.
FIX: Do not attempt to pull_hotlinked_image for raw_html
David Taylor39ac476db602
diff --git a/app/jobs/regular/pull_hotlinked_images.rb b/app/jobs/regular/pull_hotlinked_images.rbindex 8ecade8206c..eeac9ff89ea 100644--- a/app/jobs/regular/pull_hotlinked_images.rb+++ b/app/jobs/regular/pull_hotlinked_images.rb@@ -16,6 +16,7 @@ module Jobspost = Post.find_by(id: @post_id)return if post.blank?return if post.topic.blank?+ return if post.cook_method == Post.cook_methods[:raw_html]raw = post.raw.dupstart_raw = raw.dupdiff --git a/spec/jobs/pull_hotlinked_images_spec.rb b/spec/jobs/pull_hotlinked_images_spec.rbindex 1d478d1d163..09fca0e6ab3 100644--- a/spec/jobs/pull_hotlinked_images_spec.rb+++ b/spec/jobs/pull_hotlinked_images_spec.rb@@ -197,6 +197,18 @@ describe Jobs::PullHotlinkedImages doexpect(post.uploads).to contain_exactly(upload)end+ it "skips raw_html posts" do+ raw = "<img src=\"#{image_url}\">"+ post = Fabricate(:post, raw: raw, cook_method: Post.cook_methods[:raw_html])+ stub_image_size+ expect do+ post.rebake!+ post.reload+ end.not_to change { Upload.count }++ expect(post.raw).to eq(raw)+ end+context "when secure media enabled for an upload that has already been downloaded and exists" doit "doesnt redownload the secure upload" dosetup_s3