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:
Jarek Radosz
2020-04-21 03:47:48 +02:00
committed by GitHub
parent e9f7262813
commit 9a6e4b1fa1
2 changed files with 14 additions and 1 deletions

View File

@@ -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
![test](https://some-site.com/a_test?q=1&b=hello%20there)
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