This instance will be upgraded to Heptapod 0.27.1 on 2021-12-02 at 15:00 UTC+1 (a few minutes of down time)

Commit 69cb5fba authored by Francesco Levorato's avatar Francesco Levorato
Browse files

Make Project#find_with_namespace case-insensitive

parent 5dd85cf89850
......@@ -235,10 +235,10 @@ def find_with_namespace(id)
return nil unless id.include?('/')
id = id.split('/')
namespace = Namespace.find_by(path: id.first)
namespace = Namespace.by_path(id.first)
return nil unless namespace
where(namespace_id: namespace.id).find_by(path: id.second)
where(namespace_id: namespace.id).where("LOWER(projects.path) = :path", path: id.second.downcase).first
end
def visibility_levels
......
......@@ -220,6 +220,7 @@
end
it { expect(Project.find_with_namespace('gitlab/gitlabhq')).to eq(@project) }
it { expect(Project.find_with_namespace('GitLab/GitlabHQ')).to eq(@project) }
it { expect(Project.find_with_namespace('gitlab-ci')).to be_nil }
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