Commit c8f02855 authored by Dmytro Zaporozhets's avatar Dmytro Zaporozhets

Merge branch '218823-wiki-base-path-relative-url-root' into 'master'

Fix relative URL root in wiki_base_path

See merge request gitlab-org/gitlab!33841
parents 0a180d2d 9a748ec1
......@@ -205,7 +205,7 @@ class Wiki
end
def wiki_base_path
Gitlab.config.gitlab.relative_url_root + web_url(only_path: true).sub(%r{/#{Wiki::HOMEPAGE}\z}, '')
web_url(only_path: true).sub(%r{/#{Wiki::HOMEPAGE}\z}, '')
end
private
......
---
title: Fix relative URL root in wiki_base_path
merge_request: 33841
author:
type: fixed
......@@ -63,7 +63,7 @@ describe Banzai::Pipeline::WikiPipeline do
'when GitLab is hosted at a relative URL' => '/nested/relative/gitlab' }.each do |test_name, relative_url_root|
context test_name do
before do
allow(Gitlab.config.gitlab).to receive(:relative_url_root).and_return(relative_url_root)
allow(Rails.application.routes).to receive(:default_url_options).and_return(script_name: relative_url_root)
end
describe "linking to pages within the wiki" do
......
......@@ -32,6 +32,13 @@ RSpec.shared_examples 'wiki model' do
it 'returns the wiki base path' do
expect(subject.wiki_base_path).to eq("#{wiki_container.web_url(only_path: true)}/-/wikis")
end
it 'includes the relative URL root' do
allow(Rails.application.routes).to receive(:default_url_options).and_return(script_name: '/root')
expect(subject.wiki_base_path).to start_with('/root/')
expect(subject.wiki_base_path).not_to start_with('/root/root')
end
end
describe '#wiki' 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