A platform for community discussion. Free, open, simple.
FIX: Ensure pull-hotlinked can rewrite lone oneboxes (#17354)
David Taylor2d5d15b4bb6d
diff --git a/app/services/inline_uploads.rb b/app/services/inline_uploads.rbindex 3cc45a6b5a9..62d081caa32 100644--- a/app/services/inline_uploads.rb+++ b/app/services/inline_uploads.rb@@ -245,7 +245,7 @@ class InlineUploads# Markdown inline - InlineUploads.match_md_inline_img(raw, external_src: true, &replace)- raw.gsub!(/^(https?:\/\/\S+)(\s?)$/) do |match|+ raw = raw.gsub(/^(https?:\/\/\S+)(\s?)$/) do |match|if upload = blk.call(match)""elsediff --git a/spec/jobs/pull_hotlinked_images_spec.rb b/spec/jobs/pull_hotlinked_images_spec.rbindex 3de3afc1c83..187e93e6881 100644--- a/spec/jobs/pull_hotlinked_images_spec.rb+++ b/spec/jobs/pull_hotlinked_images_spec.rb@@ -423,6 +423,25 @@ describe Jobs::PullHotlinkedImages doexpect(post.cooked).to match(/<span class="broken-image/)expect(post.cooked).to match(/<div class="large-image-placeholder">/)end++ it 'rewrites a lone onebox' do+ post = Fabricate(:post, raw: <<~MD)+ Onebox here:+ #{image_url}+ MD+ stub_image_size++ post.rebake!++ post.reload++ expect(post.raw).to eq(<<~MD.chomp)+ Onebox here:+ + MD++ expect(post.cooked).to match(/<img src=.*\/uploads/)+ endendend