A platform for community discussion. Free, open, simple.
FIX: Remove onebox src from `Jobs::PullHotlinkedImages`.
Guo Xiang Tanc9db89777727
diff --git a/app/jobs/regular/pull_hotlinked_images.rb b/app/jobs/regular/pull_hotlinked_images.rbindex de8bc07cbae..a42d45c08a1 100644--- a/app/jobs/regular/pull_hotlinked_images.rb+++ b/app/jobs/regular/pull_hotlinked_images.rb@@ -71,6 +71,7 @@ module Jobsfilename = File.basename(URI.parse(src).path)filename << File.extname(hotlinked.path) unless filename["."]upload = UploadCreator.new(hotlinked, filename, origin: src).create_for(post.user_id)+if upload.persisted?downloaded_urls[src] = upload.urldownloaded_images[remove_scheme(src)] = upload.id@@ -148,7 +149,7 @@ module Jobsdef extract_images_from(html)doc = Nokogiri::HTML::fragment(html)- doc.css("img[src], a.lightbox[href], a.onebox[href]") -+ doc.css("img[src], a.lightbox[href]") -doc.css("img.avatar") -doc.css(".lightbox img[src]")enddiff --git a/spec/jobs/pull_hotlinked_images_spec.rb b/spec/jobs/pull_hotlinked_images_spec.rbindex 25b086f4196..17a11889b44 100644--- a/spec/jobs/pull_hotlinked_images_spec.rb+++ b/spec/jobs/pull_hotlinked_images_spec.rb@@ -98,23 +98,6 @@ describe Jobs::PullHotlinkedImages doexpect(post.uploads).to contain_exactly(upload)end- it 'replaces direct links' do- post = Fabricate(:post, raw: <<~MD)- #{image_url}- #{image_url}- MD-- expect { Jobs::PullHotlinkedImages.new.execute(post_id: post.id) }- .to change { Upload.count }.by(1)-- post.reload-- expect(post.raw).to eq(<<~MD.chomp)- - - MD- end-it 'replaces markdown image' dopost = Fabricate(:post, raw: <<~MD)[](https://somelink.com)