diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-12 03:07:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-12 03:07:21 +0300 |
commit | b53b2fbb6b393f28211fa2c2c5bdb519b6e7bc08 (patch) | |
tree | acde0976d5e2d1df33b922ad3afdeb8fc7db9198 /app/models/project.rb | |
parent | 213f46f188c29e9c442df61530110e172a7e819e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 08c901fc4ab..561a842f23a 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -2101,7 +2101,7 @@ class Project < ApplicationRecord pages_metadatum&.deployed? end - def pages_group_url + def pages_namespace_url # The host in URL always needs to be downcased Gitlab.config.pages.url.sub(%r{^https?://}) do |prefix| "#{prefix}#{pages_subdomain}." @@ -2109,19 +2109,23 @@ class Project < ApplicationRecord end def pages_url - url = pages_group_url + url = pages_namespace_url url_path = full_path.partition('/').last + namespace_url = "#{Settings.pages.protocol}://#{url_path}".downcase + + if Rails.env.development? + url_without_port = URI.parse(url) + url_without_port.port = nil + + return url if url_without_port.to_s == namespace_url + end # If the project path is the same as host, we serve it as group page - return url if url == "#{Settings.pages.protocol}://#{url_path}".downcase + return url if url == namespace_url "#{url}/#{url_path}" end - def pages_group_root? - pages_group_url == pages_url - end - def pages_subdomain full_path.partition('/').first end |