Skip to content
代码片段 群组 项目
未验证 提交 18dcb56b 编辑于 作者: Aakriti Gupta's avatar Aakriti Gupta 提交者: GitLab
浏览文件

Merge branch 'ngala/revert-pages-case-insensitive-path' into 'master'

Revert: Fix pages with case sensitive paths

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/142638



Merged-by: default avatarAakriti Gupta <agupta@gitlab.com>
Approved-by: default avatarArpit Gogia <12347103-arpitgogia@users.noreply.gitlab.com>
Co-authored-by: default avatarngala <ngala@gitlab.com>
No related branches found
No related tags found
无相关合并请求
...@@ -14,7 +14,18 @@ def initialize(project) ...@@ -14,7 +14,18 @@ def initialize(project)
end end
def pages_url(with_unique_domain: false) def pages_url(with_unique_domain: false)
find_url(with_unique_domain).downcase 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}"
end end
def unique_host def unique_host
...@@ -52,21 +63,6 @@ def artifact_url_available?(artifact, job) ...@@ -52,21 +63,6 @@ def artifact_url_available?(artifact, job)
attr_reader :project, :project_path 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 def namespace_url
@namespace_url ||= url_for(project_namespace) @namespace_url ||= url_for(project_namespace)
end end
...@@ -79,13 +75,14 @@ def pages_base_url ...@@ -79,13 +75,14 @@ def pages_base_url
@pages_url ||= URI(config.url) @pages_url ||= URI(config.url)
.tap { |url| url.port = config.port } .tap { |url| url.port = config.port }
.to_s .to_s
.downcase
end end
def namespace_in_path_url(with_unique_domain) def namespace_in_path_url(with_unique_domain)
if with_unique_domain if with_unique_domain
"#{pages_base_url}/#{project.project_setting.pages_unique_domain}" "#{pages_base_url}/#{project.project_setting.pages_unique_domain}".downcase
else else
"#{pages_base_url}/#{project_namespace}/#{project_path}" "#{pages_base_url}/#{project_namespace}/#{project_path}".downcase
end end
end end
...@@ -94,6 +91,7 @@ def url_for(subdomain) ...@@ -94,6 +91,7 @@ def url_for(subdomain)
.tap { |url| url.port = config.port } .tap { |url| url.port = config.port }
.tap { |url| url.host.prepend("#{subdomain}.") } .tap { |url| url.host.prepend("#{subdomain}.") }
.to_s .to_s
.downcase
end end
def portless(url) def portless(url)
......
...@@ -63,12 +63,6 @@ ...@@ -63,12 +63,6 @@
it { is_expected.to eq('http://group.example.com/project') } it { is_expected.to eq('http://group.example.com/project') }
end end
context 'when project is upper cased' do
let(:full_path) { 'group/Project' }
it { is_expected.to eq('http://group.example.com/project') }
end
context 'when project is in a nested group page' do context 'when project is in a nested group page' do
let(:full_path) { 'group/subgroup/project' } let(:full_path) { 'group/subgroup/project' }
...@@ -133,12 +127,6 @@ ...@@ -133,12 +127,6 @@
it { is_expected.to eq('http://example.com/group/project') } it { is_expected.to eq('http://example.com/group/project') }
end end
context 'when project is upper cased' do
let(:full_path) { 'group/Project' }
it { is_expected.to eq('http://example.com/group/project') }
end
context 'when project is in a nested group page' do context 'when project is in a nested group page' do
let(:full_path) { 'group/subgroup/project' } let(:full_path) { 'group/subgroup/project' }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册