DEV: Fix edge case for `InlineUploads`.
This commit is contained in:
parent
ecb2fd8222
commit
5d16d10a9e
|
@ -100,7 +100,7 @@ class InlineUploads
|
|||
end
|
||||
end
|
||||
|
||||
markdown.scan(/((\n|\s)+)#{regexp}/) do |match|
|
||||
markdown.scan(/(([\n\s\)\]\<])+)#{regexp}/) do |match|
|
||||
if matched_uploads(match[2]).present?
|
||||
next if indexes.include?($~.offset(3)[0])
|
||||
|
||||
|
|
|
@ -234,6 +234,20 @@ RSpec.describe InlineUploads do
|
|||
MD
|
||||
end
|
||||
|
||||
it "should correct image URLs that follows an image md" do
|
||||
md = <<~MD
|
||||
![image|690x290](#{upload.short_url})#{Discourse.base_url}#{upload2.url}
|
||||
|
||||
<#{Discourse.base_url}#{upload2.url}>
|
||||
MD
|
||||
|
||||
expect(InlineUploads.process(md)).to eq(<<~MD)
|
||||
![image|690x290](#{upload.short_url})#{Discourse.base_url}#{upload2.short_path}
|
||||
|
||||
<#{Discourse.base_url}#{upload2.short_path}>
|
||||
MD
|
||||
end
|
||||
|
||||
it "should correct image URLs to the short version" do
|
||||
md = <<~MD
|
||||
![image|690x290](#{upload.short_url})
|
||||
|
|
Loading…
Reference in New Issue