From 52efec12c248a2fe5fb802badda9ee5a29d7b449 Mon Sep 17 00:00:00 2001 From: chlins Date: Thu, 3 Aug 2023 10:50:44 +0800 Subject: [PATCH] fix: fix replication list projects with pure numberic name 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 485cd1d7356..611ddca5fe8 100644 --- a/src/pkg/reg/adapter/harbor/base/adapter.go +++ b/src/pkg/reg/adapter/harbor/base/adapter.go @@ -176,7 +176,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 {