FIX: URL with params for svg images should not be light boxed.
This commit is contained in:
parent
ca4d08f9d9
commit
806f0ca19d
|
@ -541,7 +541,14 @@ class CookedPostProcessor
|
||||||
private
|
private
|
||||||
|
|
||||||
def is_svg?(img)
|
def is_svg?(img)
|
||||||
File.extname(img["src"]) == '.svg'
|
path =
|
||||||
|
begin
|
||||||
|
URI(img["src"]).path
|
||||||
|
rescue URI::InvalidURIError, URI::InvalidComponentError
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
File.extname(path) == '.svg' if path
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -178,6 +178,19 @@ describe CookedPostProcessor do
|
||||||
|
|
||||||
expect(cpp.html).to match_html("<p><img src=\"/uploads/default/1/1234567890123456.svg\" width=\"690\"\ height=\"788\"></p>")
|
expect(cpp.html).to match_html("<p><img src=\"/uploads/default/1/1234567890123456.svg\" width=\"690\"\ height=\"788\"></p>")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'when image src is an URL' do
|
||||||
|
let(:post) do
|
||||||
|
Fabricate(:post, raw: '<img src="http://test.discourse/uploads/default/1/1234567890123456.svg?somepamas">')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should not add lightbox' do
|
||||||
|
SiteSetting.crawl_images = true
|
||||||
|
cpp.post_process_images
|
||||||
|
|
||||||
|
expect(cpp.html).to match_html("<p><img src=\"http://test.discourse/uploads/default/1/1234567890123456.svg?somepamas\" width=\"690\"\ height=\"788\"></p>")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue