Core panic fix when triggering a webhook of docker-registry replication

Signed-off-by: guanxiatao <guanxiatao@corp.netease.com>
This commit is contained in:
guanxiatao 2020-05-08 20:14:02 +08:00 committed by Ziming
parent 119751e0fd
commit e8655c667c

View File

@ -201,6 +201,10 @@ func constructReplicationPayload(event *event.ReplicationEvent) (*model.Payload,
} }
func getMetadataFromResource(resource string) (namespace, nameAndTag string) { func getMetadataFromResource(resource string) (namespace, nameAndTag string) {
// Usually resource format likes 'library/busybox:v1', but it could be 'busybox:v1' in docker registry
meta := strings.Split(resource, "/") meta := strings.Split(resource, "/")
if len(meta) == 1 {
return "", meta[0]
}
return meta[0], meta[1] return meta[0], meta[1]
} }