Merge branch 'wiki-fix' into 'master'

Use the proper GitLab URL for links in Wiki

Fixes gitlab-org/gitlab-ce#17071

wiki links are proper compiled, e.g.
```
[same-level](same-level) -> <a href="same-level">same-level</a>
[sub-level](sub/level) -> <a href="sub/level">sub-level</a>
[upper-level](../upper-level) -> <a href="../upper-level">upper-level</a>
```

See merge request !4026
This commit is contained in:
Rémy Coutable 2016-05-09 10:40:01 +00:00
commit 4cc85a58e8
5 changed files with 7 additions and 4 deletions

View file

@ -36,6 +36,7 @@ v 8.8.0 (unreleased)
v 8.7.4
- 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
- Emails, Gitlab::Email::Message, Gitlab::Diff, and Premailer::Adapter::Nokogiri are now instrumented

View file

@ -40,7 +40,7 @@ class ProjectWiki
end
def wiki_base_path
["/", @project.path_with_namespace, "/wikis"].join('')
[Gitlab.config.gitlab.url, "/", @project.path_with_namespace, "/wikis"].join('')
end
# Returns the Gollum::Wiki object.

View file

@ -62,7 +62,7 @@ module Gitlab
end
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

View file

@ -112,7 +112,7 @@ describe Gitlab::UrlBuilder, lib: true do
wiki_page = 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

View file

@ -38,7 +38,9 @@ describe ProjectWiki, models: true do
describe "#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)
end
end