Skip to content

Commit

Permalink
[cherry-pick] fix: fix replication list projects with pure numberic n…
Browse files Browse the repository at this point in the history
…ame (#19093)

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 <chenyuzh@vmware.com>
  • Loading branch information
chlins authored Aug 7, 2023
1 parent c1bb162 commit 60ba848
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pkg/reg/adapter/harbor/base/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 60ba848

Please sign in to comment.