summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-07 09:57:05 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-07 09:57:05 +0000
commit14805d6f5c36f9901e96ddb6192cade7cbce67de (patch)
tree07e9f075be0d65cadec36043a9d8304955de7ea3
parent662cf2cef40b97b983b85abb7d68b8a81b170bc3 (diff)
parenta5314e79f26f7f0de43388a0fde142d91f3ddd96 (diff)
downloadgitlab-ce-14805d6f5c36f9901e96ddb6192cade7cbce67de.tar.gz
Merge branch 'url-builder-fix-for-relative-urls' into 'master'
Fix URL construction for merge requests, issues, notes, and commits for relative URL config This MR fixes the constructor of URL links for systems using relative URLs in the application config. The `host` parameter was used improperly, supplying an extra path (e.g. https://mydomain.com/gitlab) and unnecessary scheme. We should be able to default to the URL options set in `8_default_url_options.rb` file. Closes https://github.com/gitlabhq/gitlabhq/issues/9605 See merge request !1250
-rw-r--r--CHANGELOG1
-rw-r--r--lib/gitlab/url_builder.rb8
2 files changed, 3 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG
index cd3a7b24945..d9abc0cbc9e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
Please view this file on the master branch, on stable branches it's out of date.
v 8.0.0 (unreleased)
+ - Fix URL construction for merge requests, issues, notes, and commits for relative URL config (Stan Hu)
- Omit filename in Content-Disposition header in raw file download to avoid RFC 6266 encoding issues (Stan HU)
- Fix broken Wiki Page History (Stan Hu)
- Prevent anchors from being hidden by header (Stan Hu)
diff --git a/lib/gitlab/url_builder.rb b/lib/gitlab/url_builder.rb
index 11b0d44f340..779819bc2bf 100644
--- a/lib/gitlab/url_builder.rb
+++ b/lib/gitlab/url_builder.rb
@@ -23,12 +23,12 @@ module Gitlab
def build_issue_url(id)
issue = Issue.find(id)
- issue_url(issue, host: Gitlab.config.gitlab['url'])
+ issue_url(issue)
end
def build_merge_request_url(id)
merge_request = MergeRequest.find(id)
- merge_request_url(merge_request, host: Gitlab.config.gitlab['url'])
+ merge_request_url(merge_request)
end
def build_note_url(id)
@@ -37,22 +37,18 @@ module Gitlab
namespace_project_commit_url(namespace_id: note.project.namespace,
id: note.commit_id,
project_id: note.project,
- host: Gitlab.config.gitlab['url'],
anchor: "note_#{note.id}")
elsif note.for_issue?
issue = Issue.find(note.noteable_id)
issue_url(issue,
- host: Gitlab.config.gitlab['url'],
anchor: "note_#{note.id}")
elsif note.for_merge_request?
merge_request = MergeRequest.find(note.noteable_id)
merge_request_url(merge_request,
- host: Gitlab.config.gitlab['url'],
anchor: "note_#{note.id}")
elsif note.for_project_snippet?
snippet = Snippet.find(note.noteable_id)
project_snippet_url(snippet,
- host: Gitlab.config.gitlab['url'],
anchor: "note_#{note.id}")
end
end