Merge pull request #2550 from ywk253100/170616_replication

Fix bug: can not replicate repository with multiple namespaces
This commit is contained in:
Wenkai Yin 2017-06-20 16:41:53 +08:00 committed by GitHub
commit 3522332430

View File

@ -29,6 +29,7 @@ import (
"github.com/docker/distribution/manifest/schema2"
"github.com/vmware/harbor/src/common/dao"
"github.com/vmware/harbor/src/common/models"
comutils "github.com/vmware/harbor/src/common/utils"
"github.com/vmware/harbor/src/common/utils/log"
"github.com/vmware/harbor/src/common/utils/registry"
"github.com/vmware/harbor/src/common/utils/registry/auth"
@ -98,7 +99,7 @@ func InitBaseHandler(repository, srcURL, srcSecret,
logger: logger,
}
base.project = getProjectName(base.repository)
base.project, _ = comutils.ParseRepository(base.repository)
return base
}
@ -108,12 +109,6 @@ func (b *BaseHandler) Exit() error {
return nil
}
func getProjectName(repository string) string {
repository = strings.TrimSpace(repository)
repository = strings.TrimRight(repository, "/")
return repository[:strings.LastIndex(repository, "/")]
}
// Initializer creates clients for source and destination registry,
// lists tags of the repository if parameter tags is nil.
type Initializer struct {