Commit 14b36f91 authored by Artem Sidorenko's avatar Artem Sidorenko

Use the proper GitLab URL for links in Wiki

parent 0a103e98
...@@ -36,6 +36,7 @@ v 8.8.0 (unreleased) ...@@ -36,6 +36,7 @@ v 8.8.0 (unreleased)
v 8.7.4 v 8.7.4
- Fix always showing build notification message when switching between merge requests - Fix always showing build notification message when switching between merge requests
- Fix links on wiki pages for relative url setups. !4026 (Artem Sidorenko)
v 8.7.3 v 8.7.3
- Emails, Gitlab::Email::Message, Gitlab::Diff, and Premailer::Adapter::Nokogiri are now instrumented - Emails, Gitlab::Email::Message, Gitlab::Diff, and Premailer::Adapter::Nokogiri are now instrumented
......
...@@ -40,7 +40,7 @@ def http_url_to_repo ...@@ -40,7 +40,7 @@ def http_url_to_repo
end end
def wiki_base_path def wiki_base_path
["/", @project.path_with_namespace, "/wikis"].join('') [Gitlab.config.gitlab.url, "/", @project.path_with_namespace, "/wikis"].join('')
end end
# Returns the Gollum::Wiki object. # Returns the Gollum::Wiki object.
......
...@@ -62,7 +62,7 @@ def note_url ...@@ -62,7 +62,7 @@ def note_url
end end
def wiki_page_url def wiki_page_url
"#{Gitlab.config.gitlab.url}#{object.wiki.wiki_base_path}/#{object.slug}" "#{object.wiki.wiki_base_path}/#{object.slug}"
end end
end end
end end
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
wiki_page = build(:wiki_page) wiki_page = build(:wiki_page)
url = described_class.build(wiki_page) url = described_class.build(wiki_page)
expect(url).to eq "#{Gitlab.config.gitlab.url}#{wiki_page.wiki.wiki_base_path}/#{wiki_page.slug}" expect(url).to eq "#{Gitlab.config.gitlab.url}/#{wiki_page.wiki.project.path_with_namespace}/wikis/#{wiki_page.slug}"
end end
end end
end end
......
...@@ -38,7 +38,9 @@ ...@@ -38,7 +38,9 @@
describe "#wiki_base_path" do describe "#wiki_base_path" do
it "returns the wiki base path" do it "returns the wiki base path" do
wiki_base_path = "/#{project.path_with_namespace}/wikis" gitlab_url = Gitlab.config.gitlab.url
wiki_base_path = "#{gitlab_url}/#{project.path_with_namespace}/wikis"
expect(subject.wiki_base_path).to eq(wiki_base_path) expect(subject.wiki_base_path).to eq(wiki_base_path)
end end
end end
......
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