Skip to content
Snippets Groups Projects
Commit d67df64a authored by Paco Guzmán's avatar Paco Guzmán
Browse files

Don't parse Rinku returned value to DocFragment when didn't change original html string.

parent 240a4aa6
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -64,6 +64,7 @@ v 8.10.0 (unreleased)
- Collapse large diffs by default (!4990)
- Fix mentioned users list on diff notes
- Fix creation of deployment on build that is retried, redeployed or rollback
- Don't parse Rinku returned value to DocFragment when it didn't change the original html string.
- Check for conflicts with existing Project's wiki path when creating a new project.
- Show last push widget in upstream after push to fork
- Fix stage status shown for pipelines
......
......@@ -56,6 +56,8 @@ def rinku_parse
# period (e.g., http://localhost:3000/)
rinku = Rinku.auto_link(html, :urls, options, IGNORE_PARENTS.to_a, 1)
return if rinku == html
# Rinku returns a String, so parse it back to a Nokogiri::XML::Document
# for further processing.
@doc = parse_html(rinku)
......
......@@ -15,6 +15,16 @@
expect(filter(act).to_html).to eq exp
end
context 'when the input contains no links' do
it 'does not parse_html back the rinku returned value' do
act = HTML::Pipeline.parse('<p>This text contains no links to autolink</p>')
expect_any_instance_of(described_class).not_to receive(:parse_html)
filter(act).to_html
end
end
context 'Rinku schemes' do
it 'autolinks http' do
doc = filter("See #{link}")
......@@ -58,6 +68,16 @@
expect(filter(act).to_html).to eq exp
end
end
context 'when the input contains link' do
it 'does parse_html back the rinku returned value' do
act = HTML::Pipeline.parse("<p>See #{link}</p>")
expect_any_instance_of(described_class).to receive(:parse_html).at_least(:once).and_call_original
filter(act).to_html
end
end
end
context 'other schemes' do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment