Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/pages/url_builder.rb')
-rw-r--r--lib/gitlab/pages/url_builder.rb34
1 files changed, 18 insertions, 16 deletions
diff --git a/lib/gitlab/pages/url_builder.rb b/lib/gitlab/pages/url_builder.rb
index f01ec54b853..4d025af4ce5 100644
--- a/lib/gitlab/pages/url_builder.rb
+++ b/lib/gitlab/pages/url_builder.rb
@@ -14,18 +14,7 @@ module Gitlab
end
def pages_url(with_unique_domain: false)
- return namespace_in_path_url(with_unique_domain && unique_domain_enabled?) if config.namespace_in_path
- return unique_url if with_unique_domain && unique_domain_enabled?
-
- project_path_url = "#{config.protocol}://#{project_path}".downcase
-
- # If the project path is the same as host, we serve it as group page
- # On development we ignore the URL port to make it work on GDK
- return namespace_url if Rails.env.development? && portless(namespace_url) == project_path_url
- # If the project path is the same as host, we serve it as group page
- return namespace_url if namespace_url == project_path_url
-
- "#{namespace_url}/#{project_path}"
+ find_url(with_unique_domain).downcase
end
def unique_host
@@ -63,6 +52,21 @@ module Gitlab
attr_reader :project, :project_path
+ def find_url(with_unique_domain)
+ return namespace_in_path_url(with_unique_domain && unique_domain_enabled?) if config.namespace_in_path
+ return unique_url if with_unique_domain && unique_domain_enabled?
+
+ project_path_url = "#{config.protocol}://#{project_path}"
+
+ # If the project path is the same as host, we serve it as group page
+ # On development we ignore the URL port to make it work on GDK
+ return namespace_url if Rails.env.development? && portless(namespace_url) == project_path_url
+ # If the project path is the same as host, we serve it as group page
+ return namespace_url if namespace_url == project_path_url
+
+ "#{namespace_url}/#{project_path}"
+ end
+
def namespace_url
@namespace_url ||= url_for(project_namespace)
end
@@ -75,14 +79,13 @@ module Gitlab
@pages_url ||= URI(config.url)
.tap { |url| url.port = config.port }
.to_s
- .downcase
end
def namespace_in_path_url(with_unique_domain)
if with_unique_domain
- "#{pages_base_url}/#{project.project_setting.pages_unique_domain}".downcase
+ "#{pages_base_url}/#{project.project_setting.pages_unique_domain}"
else
- "#{pages_base_url}/#{project_namespace}/#{project_path}".downcase
+ "#{pages_base_url}/#{project_namespace}/#{project_path}"
end
end
@@ -91,7 +94,6 @@ module Gitlab
.tap { |url| url.port = config.port }
.tap { |url| url.host.prepend("#{subdomain}.") }
.to_s
- .downcase
end
def portless(url)