Fix regression with old wiki image uploads

parent a6080c29
......@@ -126,7 +126,8 @@ module MarkupHelper
text = wiki_page.content
return '' unless text.present?
html = markup_unsafe(wiki_page.path, text, render_wiki_content_context(@wiki, wiki_page, context))
context = render_wiki_content_context(@wiki, wiki_page, context)
html = markup_unsafe(wiki_page.path, text, context)
prepare_for_rendering(html, context)
end
......
---
title: Fix regression with old wiki image uploads
merge_request: 52656
author:
type: fixed
......@@ -355,6 +355,21 @@ RSpec.describe MarkupHelper do
expect(doc.css('.gl-label-link')).not_to be_empty
end
end
context 'when content has uploads' do
let(:upload_link) { '/uploads/test.png' }
let(:content) { "![ImageTest](#{upload_link})" }
before do
allow(wiki).to receive(:wiki_base_path).and_return(project.wiki.wiki_base_path)
end
it 'renders uploads relative to project' do
result = helper.render_wiki_content(wiki)
expect(result).to include("#{project.full_path}#{upload_link}")
end
end
end
context 'when file is Asciidoc' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment