mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:09:00 +08:00
FIX: InlineUploads
matching on external bbcode img url.
This commit is contained in:
parent
782e583844
commit
7a0d031bc4
|
@ -166,7 +166,9 @@ class InlineUploads
|
|||
|
||||
def self.match_bbcode_img(markdown)
|
||||
markdown.scan(/(\[img\]\s?(.+)\s?\[\/img\])/) do |match|
|
||||
yield(match[0], match[1], +"![](#{PLACEHOLDER})", $~.offset(0)[0]) if block_given?
|
||||
if matched_uploads(match[1]).present? && block_given?
|
||||
yield(match[0], match[1], +"![](#{PLACEHOLDER})", $~.offset(0)[0])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -161,7 +161,9 @@ RSpec.describe InlineUploads do
|
|||
|
||||
it "should correct bbcode img URLs to the short version" do
|
||||
md = <<~MD
|
||||
[img]http://some.external.img[/img]
|
||||
[img]#{upload.url}[/img]
|
||||
<img src="#{upload3.url}">
|
||||
|
||||
[img]
|
||||
#{upload2.url}
|
||||
|
@ -169,7 +171,9 @@ RSpec.describe InlineUploads do
|
|||
MD
|
||||
|
||||
expect(InlineUploads.process(md)).to eq(<<~MD)
|
||||
[img]http://some.external.img[/img]
|
||||
![](#{upload.short_url})
|
||||
![](#{upload3.short_url})
|
||||
|
||||
![](#{upload2.short_url})
|
||||
MD
|
||||
|
|
Loading…
Reference in New Issue
Block a user