mirror of https://github.com/portainer/portainer
fix(registries): remove trailing slash and protocol in registry URLs (#4131)
* feat(registries) prevent trailing slash * fix(registries) avoid trailing slash in update registry * fix(registries) include trailing slash removal notice in tooltips * fix(registries) remove protocol when updating existing registry * fix(registries) uniform usage of string replace function for registry updatepull/4163/head
parent
82064152ec
commit
7aaf9d0eb7
|
@ -30,7 +30,7 @@
|
|||
<div class="form-group">
|
||||
<label for="registry_url" class="col-sm-3 col-lg-2 control-label text-left">
|
||||
Registry URL
|
||||
<portainer-tooltip position="bottom" message="URL or IP address of a Docker registry. Any protocol will be stripped."></portainer-tooltip>
|
||||
<portainer-tooltip position="bottom" message="URL or IP address of a Docker registry. Any protocol and trailing slash will be stripped if present."></portainer-tooltip>
|
||||
</label>
|
||||
<div class="col-sm-9 col-lg-10">
|
||||
<input type="text" class="form-control" id="registry_url" name="registry_url" ng-model="$ctrl.model.URL" placeholder="10.0.0.10:5000 or myregistry.domain.tld" required />
|
||||
|
|
|
@ -51,6 +51,7 @@ export function RegistryCreateRequest(model) {
|
|||
this.Name = model.Name;
|
||||
this.Type = model.Type;
|
||||
this.URL = _.replace(model.URL, /^https?\:\/\//i, '');
|
||||
this.URL = _.replace(this.URL, /\/$/, '');
|
||||
this.Authentication = model.Authentication;
|
||||
if (model.Authentication) {
|
||||
this.Username = model.Username;
|
||||
|
|
|
@ -62,6 +62,8 @@ angular.module('portainer.app').factory('RegistryService', [
|
|||
};
|
||||
|
||||
service.updateRegistry = function (registry) {
|
||||
registry.URL = _.replace(registry.URL, /^https?\:\/\//i, '');
|
||||
registry.URL = _.replace(registry.URL, /\/$/, '');
|
||||
return Registries.update({ id: registry.Id }, registry).$promise;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,10 @@
|
|||
<div class="form-group">
|
||||
<label for="registry_url" class="col-sm-3 col-lg-2 control-label text-left">
|
||||
Registry URL
|
||||
<portainer-tooltip position="bottom" message="URL or IP address of a Docker registry."></portainer-tooltip>
|
||||
<portainer-tooltip
|
||||
position="bottom"
|
||||
message="URL or IP address of a Docker registry. Any protocol or trailing slash will be stripped if present."
|
||||
></portainer-tooltip>
|
||||
</label>
|
||||
<div class="col-sm-9 col-lg-10">
|
||||
<input type="text" class="form-control" id="registry_url" ng-model="registry.URL" placeholder="e.g. 10.0.0.10:5000 or myregistry.domain.tld" />
|
||||
|
|
Loading…
Reference in New Issue