mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Edge case with anchor tag in InlineUploads.
This commit is contained in:
@@ -56,6 +56,26 @@ describe Jobs::PullHotlinkedImages do
|
||||
expect(post.reload.raw).to eq("")
|
||||
end
|
||||
|
||||
it 'replaces images in an anchor tag with weird indentation' do
|
||||
post = Fabricate(:post, raw: <<~RAW)
|
||||
<a href="https://somelink.com">
|
||||
<img alt="somelink" src="#{image_url}" />
|
||||
</a>
|
||||
RAW
|
||||
|
||||
expect do
|
||||
Jobs::PullHotlinkedImages.new.execute(post_id: post.id)
|
||||
end.to change { Upload.count }.by(1)
|
||||
|
||||
expect(post.reload.raw).to eq(<<~RAW.chomp)
|
||||
<a href="https://somelink.com">
|
||||
|
||||

|
||||
|
||||
</a>
|
||||
RAW
|
||||
end
|
||||
|
||||
it 'replaces images without protocol' do
|
||||
url = image_url.sub(/^https?\:/, '')
|
||||
post = Fabricate(:post, raw: "<img alt='test' src='#{url}'>")
|
||||
|
||||
Reference in New Issue
Block a user