Commit c4120fb1 authored by Steve Abrams's avatar Steve Abrams

Remove protocol from Dependency Proxy UI

Remove the protocol from the Dependency Proxy URL
on the group page.

Rename to Dependency Proxy Image Prefix to be more
accurate.

Changelog: changed
parent 86abff01
......@@ -64,10 +64,13 @@ module GroupsHelper
.count
end
def group_dependency_proxy_url(group)
def group_dependency_proxy_image_prefix(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}"
url = "#{group_url(group).downcase}#{DependencyProxy::URL_SUFFIX}"
# Docker images do not include the protocol
url.partition('//').last
end
def group_icon_url(group, options = {})
......
- proxy_url = group_dependency_proxy_url(@group)
- proxy_url = group_dependency_proxy_image_prefix(@group)
%h5.prepend-top-20= _('Dependency proxy URL')
%h5.prepend-top-20= _('Dependency proxy image prefix')
.row
.col-lg-8.col-md-12.input-group
......
......@@ -10977,10 +10977,10 @@ msgstr ""
msgid "Dependency proxy"
msgstr ""
msgid "Dependency proxy URL"
msgid "Dependency proxy feature is limited to public groups for now."
msgstr ""
msgid "Dependency proxy feature is limited to public groups for now."
msgid "Dependency proxy image prefix"
msgstr ""
msgid "DependencyProxy|Toggle Dependency Proxy"
......
......@@ -19,11 +19,15 @@ RSpec.describe GroupsHelper do
end
end
describe '#group_dependency_proxy_url' do
describe '#group_dependency_proxy_image_prefix' do
let_it_be(:group) { build_stubbed(:group, path: 'GroupWithUPPERcaseLetters') }
it 'converts uppercase letters to lowercase' do
group = build_stubbed(:group, path: 'GroupWithUPPERcaseLetters')
expect(group_dependency_proxy_image_prefix(group)).to end_with("/groupwithuppercaseletters#{DependencyProxy::URL_SUFFIX}")
end
expect(group_dependency_proxy_url(group)).to end_with("/groupwithuppercaseletters#{DependencyProxy::URL_SUFFIX}")
it 'removes the protocol' do
expect(group_dependency_proxy_image_prefix(group)).not_to include('http')
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