fix(images): fix the way the registry and image name are extracted fr… (#1099)

* fix(images): fix the way the registry and image name are extracted from a repository
pull/1101/head
Anthony Lapenna 2017-08-09 10:40:46 +02:00 committed by GitHub
parent 12adeadc94
commit d7769dec33
1 changed files with 8 additions and 3 deletions

View File

@ -8,10 +8,15 @@ angular.module('portainer.helpers')
var slashCount = _.countBy(repository)['/'];
var registry = null;
var image = repository;
if (slashCount > 1) {
// assume something/some/thing[/...]
if (slashCount >= 1) {
// assume something/something[/...]
registry = repository.substr(0, repository.indexOf('/'));
// assume valid DNS name or IP (contains at least one '.')
if (_.countBy(registry)['.'] > 0) {
image = repository.substr(repository.indexOf('/') + 1);
} else {
registry = null;
}
}
return {