Commit 14cba850 authored by Eric Engestrom's avatar Eric Engestrom

app: add helper function to computer a group's Dependency Proxy URL

parent 3b5f46c4
......@@ -99,6 +99,12 @@ module GroupsHelper
.count
end
def group_dependency_proxy_url(group)
# The namespace path can include uppercase letters, which
# Docker doesn't allow. The proxy expects it to be downcased.
"#{group_url(group).downcase}#{DependencyProxy::URL_SUFFIX}"
end
def group_icon_url(group, options = {})
if group.is_a?(String)
group = Group.find_by_full_path(group)
......
-# The namespace path can include uppercase letters, which
-# Docker doesn't allow. The proxy expects it to be downcased.
- proxy_url = "#{group_url(@group).downcase}#{DependencyProxy::URL_SUFFIX}"
- proxy_url = group_dependency_proxy_url(@group)
%h5.prepend-top-20= _('Dependency proxy URL')
......
......@@ -23,6 +23,13 @@ RSpec.describe GroupsHelper do
end
end
describe 'group_dependency_proxy_url' do
it 'converts uppercase letters to lowercase' do
group = create(:group, path: 'GroupWithUPPERcaseLetters')
expect(group_dependency_proxy_url(group)).to end_with("/groupwithuppercaseletters#{DependencyProxy::URL_SUFFIX}")
end
end
describe 'group_lfs_status' do
let(:group) { create(:group) }
let!(:project) { create(:project, namespace_id: group.id) }
......
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