summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-05-07 00:28:35 -0700
committerStan Hu <stanhu@gmail.com>2019-05-07 06:16:39 -0700
commit58c09eb70941a0954fb5cd7b0c6316c698353edb (patch)
treeaec474d2b38d02064e50b2eed8acd19b242954a9 /lib
parentfb688545e51d87d3b145b0c7fa9adc8c6b2139b2 (diff)
downloadgitlab-ce-58c09eb70941a0954fb5cd7b0c6316c698353edb.tar.gz
Use a path for the related merge requests endpointsh-fix-related-merge-requests-path
Hosts using a non-standard configuration may have a different hostname/port/scheme than what may be configured on the GitLab server. While expose_url should generate a proper URL, there are cases where it may not work. Since we don't need the full URL, we can use the relative path. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/61280
Diffstat (limited to 'lib')
-rw-r--r--lib/api/helpers/related_resources_helpers.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/api/helpers/related_resources_helpers.rb b/lib/api/helpers/related_resources_helpers.rb
index 793ae11b41d..9cdde25fe4e 100644
--- a/lib/api/helpers/related_resources_helpers.rb
+++ b/lib/api/helpers/related_resources_helpers.rb
@@ -13,6 +13,10 @@ module API
available?(:merge_requests, project, options[:current_user])
end
+ def expose_path(path)
+ Gitlab::Utils.append_path(Gitlab.config.gitlab.relative_url_root, path)
+ end
+
def expose_url(path)
url_options = Gitlab::Application.routes.default_url_options
protocol, host, port, script_name = url_options.values_at(:protocol, :host, :port, :script_name)