diff --git a/app/jobs/regular/pull_hotlinked_images.rb b/app/jobs/regular/pull_hotlinked_images.rb index 8ecade8206c..eeac9ff89ea 100644 --- a/app/jobs/regular/pull_hotlinked_images.rb +++ b/app/jobs/regular/pull_hotlinked_images.rb @@ -16,6 +16,7 @@ module Jobs post = 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.dup start_raw = raw.dup diff --git a/spec/jobs/pull_hotlinked_images_spec.rb b/spec/jobs/pull_hotlinked_images_spec.rb index 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 do expect(post.uploads).to contain_exactly(upload) end + it "skips raw_html posts" do + raw = "" + 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" do it "doesnt redownload the secure upload" do setup_s3