mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 10:50:26 -06:00
FIX: Correct more edge cases with InlineUploads
.
This commit is contained in:
parent
ff48fbdfda
commit
73bf880f74
@ -193,7 +193,7 @@ class InlineUploads
|
||||
end
|
||||
|
||||
def self.match_img(markdown, external_src: false)
|
||||
markdown.scan(/(<(?!img)[^<>]+\/?>)?(\n*)(([ ]*)<img ([^<>]+)>([ ]*))(\n*)/) do |match|
|
||||
markdown.scan(/(<(?!img)[^<>]+\/?>)?(\n*)(([ ]*)<img ([^>\n]+)>([ ]*))(\n*)/) do |match|
|
||||
node = Nokogiri::HTML::fragment(match[2].strip).children[0]
|
||||
src = node.attributes["src"]&.value
|
||||
|
||||
|
@ -298,6 +298,8 @@ RSpec.describe InlineUploads do
|
||||
|
||||
<img src="#{upload.url}" alt="test">
|
||||
|
||||
<img src="#{upload2.url}" alt="test" height="150<img">
|
||||
|
||||
> some quote
|
||||
|
||||
<a class="attachment" href="#{upload2.url}">test2</a>
|
||||
@ -310,6 +312,8 @@ RSpec.describe InlineUploads do
|
||||
|
||||
![test](#{upload.short_url})
|
||||
|
||||
![test](#{upload2.short_url})
|
||||
|
||||
> some quote
|
||||
|
||||
[test2|attachment](#{upload2.short_url})
|
||||
|
Loading…
Reference in New Issue
Block a user