mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-27 04:35:16 +01:00
Merge branch 'master' into dev
This commit is contained in:
commit
1d2970c3c5
@ -53,7 +53,7 @@ func ParseRepository(repository string) (project, rest string) {
|
|||||||
rest = repository
|
rest = repository
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
index := strings.LastIndex(repository, "/")
|
index := strings.Index(repository, "/")
|
||||||
project = repository[0:index]
|
project = repository[0:index]
|
||||||
rest = repository[index+1:]
|
rest = repository[index+1:]
|
||||||
return
|
return
|
||||||
|
@ -65,10 +65,10 @@ func TestParseRepository(t *testing.T) {
|
|||||||
|
|
||||||
repository = "library/test/ubuntu"
|
repository = "library/test/ubuntu"
|
||||||
project, rest = ParseRepository(repository)
|
project, rest = ParseRepository(repository)
|
||||||
if project != "library/test" {
|
if project != "library" {
|
||||||
t.Errorf("unexpected project: %s != %s", project, "library/test")
|
t.Errorf("unexpected project: %s != %s", project, "library/test")
|
||||||
}
|
}
|
||||||
if rest != "ubuntu" {
|
if rest != "test/ubuntu" {
|
||||||
t.Errorf("unexpected rest: %s != %s", rest, "ubuntu")
|
t.Errorf("unexpected rest: %s != %s", rest, "ubuntu")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ func TriggerReplication(policyID int64, repository string,
|
|||||||
func GetPoliciesByRepository(repository string) ([]*models.RepPolicy, error) {
|
func GetPoliciesByRepository(repository string) ([]*models.RepPolicy, error) {
|
||||||
repository = strings.TrimSpace(repository)
|
repository = strings.TrimSpace(repository)
|
||||||
repository = strings.TrimRight(repository, "/")
|
repository = strings.TrimRight(repository, "/")
|
||||||
projectName := repository[:strings.LastIndex(repository, "/")]
|
projectName, _ := utils.ParseRepository(repository)
|
||||||
|
|
||||||
project, err := dao.GetProjectByName(projectName)
|
project, err := dao.GetProjectByName(projectName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user