Commit d353d350 authored by Krasimir Angelov's avatar Krasimir Angelov

Fix Project#pages_url not to downcase url path

In https://gitlab.com/gitlab-org/gitlab/-/merge_requests/35300 we fixed
how to handle group root Pages with mixed case path, but the
fix broke how we generate #pages_url for project level with mixed case.

This updates Project#pages_url so that we downcase only when comparing
with #pages_group_url and retrun the original url path if the project
is not group root Pages project.

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/226874.
parent 71f1c7e5
......@@ -1700,10 +1700,10 @@ class Project < ApplicationRecord
def pages_url
url = pages_group_url
url_path = full_path.partition('/').last.downcase
url_path = full_path.partition('/').last
# If the project path is the same as host, we serve it as group page
return url if url == "#{Settings.pages.protocol}://#{url_path}"
return url if url == "#{Settings.pages.protocol}://#{url_path}".downcase
"#{url}/#{url_path}"
end
......
---
title: Fix Project#pages_url not to downcase url path
merge_request: 36183
author:
type: fixed
......@@ -1666,6 +1666,14 @@ RSpec.describe Project do
let(:project_name) { 'Project' }
it { is_expected.to eq("http://group.example.com/project") }
context 'mixed case path' do
before do
project.update!(path: 'Project')
end
it { is_expected.to eq("http://group.example.com/Project") }
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment