mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-23 00:57:44 +01:00
Merge pull request #2550 from ywk253100/170616_replication
Fix bug: can not replicate repository with multiple namespaces
This commit is contained in:
commit
3522332430
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user