From 8c23bcdc54b5e12256d57834cd3a289e77bb5b6d Mon Sep 17 00:00:00 2001 From: Chlins Zhang Date: Fri, 4 Aug 2023 09:29:51 +0800 Subject: [PATCH] fix: fix replication list projects with pure numberic name (#19090) Quote the project name when listing projects in the replication, resolve the issue of pure number name of project. Signed-off-by: chlins --- src/pkg/reg/adapter/harbor/base/adapter.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pkg/reg/adapter/harbor/base/adapter.go b/src/pkg/reg/adapter/harbor/base/adapter.go index 9dea42ac7..fb33ac248 100644 --- a/src/pkg/reg/adapter/harbor/base/adapter.go +++ b/src/pkg/reg/adapter/harbor/base/adapter.go @@ -164,7 +164,8 @@ func (a *Adapter) PrepareForPush(resources []*model.Resource) error { for p := range projects { ps = append(ps, p) } - q := fmt.Sprintf("name={%s}", strings.Join(ps, " ")) + // query by project name, decorate the name as string to avoid parsed as int by server in case of pure numbers as project name + q := fmt.Sprintf("name={'%s'}", strings.Join(ps, " ")) // get exist projects queryProjects, err := a.Client.ListProjectsWithQuery(q, false) if err != nil {