mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Make InlineUploads handle more URL formats (#9467)
It previously failed to match URLs with characters other than `[a-zA-z0-9\.\/:-]`. This meant that `PullHotlinkedImages` would sometimes download an external image and then never use it in any posts.
This commit is contained in:
@@ -712,4 +712,17 @@ RSpec.describe InlineUploads do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe ".match_md_inline_img" do
|
||||
it "matches URLs with various characters" do
|
||||
md = <<~MD
|
||||

|
||||
MD
|
||||
|
||||
url = nil
|
||||
InlineUploads.match_md_inline_img(md, external_src: true) { |_match, src| url = src }
|
||||
|
||||
expect(url).to eq("https://some-site.com/a_test?q=1&b=hello%20there")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user