Commit 3af78b5c authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'revert-4026' into 'master'

Revert "Merge branch 'wiki-fix' into 'master'"

This reverts commit 4cc85a58 (!4026), reversing
changes made to 90ae445b.

From https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4026#note_11719950:

>  1. On Ruby 2.1.x, the [`uri.path = ::File.join(project_wiki_base_path, uri.path)`](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/banzai/filter/wiki_link_filter.rb#L39) raises an `URI::InvalidComponentError: bad component(expected relative path component): http://bar.com/baz` error in `Banzai::Filter::WikiLinkFilter#rebuild_wiki_uri`, which is then rescued in [`Banzai::Filter::WikiLinkFilter#process_link_attr`](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/banzai/filter/wiki_link_filter.rb#L34), thus the link is not modified and the tests pass.
1. On Ruby 2.2.x, the same line doesn't raise an error anymore, thus tests are broken on Ruby 2.2 only. I didn't really understand yet why having absolute links in the wiki would break some tests vs having relative links as before, but I think the safest course to action is to revert this MR and to find another fix (probably just prepending `ProjectWiki#wiki_base_path` with the relative URL path component if we are in the case of a relative URL...
/cc @artem-sidorenko

Just a FYI note: no need to pick into `8-7-stable` since the original commit was not picked.

See merge request !4105
parents f96c34ec f52a15e0
...@@ -39,7 +39,6 @@ v 8.8.0 (unreleased) ...@@ -39,7 +39,6 @@ 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)
- Links for Redmine issue references are generated correctly again (Benedikt Huss) - Links for Redmine issue references are generated correctly again (Benedikt Huss)
v 8.7.3 v 8.7.3
......
...@@ -40,7 +40,7 @@ class ProjectWiki ...@@ -40,7 +40,7 @@ class ProjectWiki
end end
def wiki_base_path def wiki_base_path
[Gitlab.config.gitlab.url, "/", @project.path_with_namespace, "/wikis"].join('') ["/", @project.path_with_namespace, "/wikis"].join('')
end end
# Returns the Gollum::Wiki object. # Returns the Gollum::Wiki object.
......
...@@ -62,7 +62,7 @@ module Gitlab ...@@ -62,7 +62,7 @@ module Gitlab
end end
def wiki_page_url def wiki_page_url
"#{object.wiki.wiki_base_path}/#{object.slug}" "#{Gitlab.config.gitlab.url}#{object.wiki.wiki_base_path}/#{object.slug}"
end end
end end
end end
...@@ -112,7 +112,7 @@ describe Gitlab::UrlBuilder, lib: true do ...@@ -112,7 +112,7 @@ describe Gitlab::UrlBuilder, lib: true do
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.project.path_with_namespace}/wikis/#{wiki_page.slug}" expect(url).to eq "#{Gitlab.config.gitlab.url}#{wiki_page.wiki.wiki_base_path}/#{wiki_page.slug}"
end end
end end
end end
......
...@@ -38,9 +38,7 @@ describe ProjectWiki, models: true do ...@@ -38,9 +38,7 @@ describe ProjectWiki, models: true do
describe "#wiki_base_path" do describe "#wiki_base_path" do
it "returns the wiki base path" do it "returns the wiki base path" do
gitlab_url = Gitlab.config.gitlab.url wiki_base_path = "/#{project.path_with_namespace}/wikis"
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