mirror of
https://github.com/discourse/discourse.git
synced 2025-06-07 20:04:40 +08:00
DEV: Fix edge case for InlineUploads
.
This commit is contained in:
@ -100,7 +100,7 @@ class InlineUploads
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
markdown.scan(/((\n|\s)+)#{regexp}/) do |match|
|
markdown.scan(/(([\n\s\)\]\<])+)#{regexp}/) do |match|
|
||||||
if matched_uploads(match[2]).present?
|
if matched_uploads(match[2]).present?
|
||||||
next if indexes.include?($~.offset(3)[0])
|
next if indexes.include?($~.offset(3)[0])
|
||||||
|
|
||||||
|
@ -234,6 +234,20 @@ RSpec.describe InlineUploads do
|
|||||||
MD
|
MD
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should correct image URLs that follows an image md" do
|
||||||
|
md = <<~MD
|
||||||
|
#{Discourse.base_url}#{upload2.url}
|
||||||
|
|
||||||
|
<#{Discourse.base_url}#{upload2.url}>
|
||||||
|
MD
|
||||||
|
|
||||||
|
expect(InlineUploads.process(md)).to eq(<<~MD)
|
||||||
|
#{Discourse.base_url}#{upload2.short_path}
|
||||||
|
|
||||||
|
<#{Discourse.base_url}#{upload2.short_path}>
|
||||||
|
MD
|
||||||
|
end
|
||||||
|
|
||||||
it "should correct image URLs to the short version" do
|
it "should correct image URLs to the short version" do
|
||||||
md = <<~MD
|
md = <<~MD
|
||||||

|

|
||||||
|
Reference in New Issue
Block a user