Commit e4682bc5 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'pages-api-lowercase-namespaces' into 'master'

Fix finding namespace with mixed case saved path

See merge request gitlab-org/gitlab!27566
parents df703e9f db49dba1
......@@ -130,7 +130,7 @@ class Namespace < ApplicationRecord
return unless host.ends_with?(gitlab_host)
name = host.delete_suffix(gitlab_host)
Namespace.where(parent_id: nil).find_by_path(name)
Namespace.where(parent_id: nil).by_path(name)
end
# overridden in ee
......
......@@ -194,7 +194,7 @@ describe Namespace do
describe '.find_by_pages_host' do
it 'finds namespace by GitLab Pages host and is case-insensitive' do
namespace = create(:namespace, name: 'topnamespace')
namespace = create(:namespace, name: 'topNAMEspace', path: 'topNAMEspace')
create(:namespace, name: 'annother_namespace')
host = "TopNamespace.#{Settings.pages.host.upcase}"
......
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