From e0fac5b61a150604b3efe5cd1ba05ab3b7fdc772 Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Tue, 6 Aug 2019 15:41:20 +0800 Subject: [PATCH] Fixes #8281, only show one tag in the task list to decrease the length of string Fixes #8281, only show one tag in the task list to decrease the length of string to avoid exceeding the limit in database Signed-off-by: Wenkai Yin --- src/replication/operation/flow/stage.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/replication/operation/flow/stage.go b/src/replication/operation/flow/stage.go index 5476f3c13..27110f001 100644 --- a/src/replication/operation/flow/stage.go +++ b/src/replication/operation/flow/stage.go @@ -17,7 +17,6 @@ package flow import ( "errors" "fmt" - "strings" "time" "github.com/goharbor/harbor/src/common/utils/log" @@ -331,15 +330,16 @@ func getResourceName(res *model.Resource) string { if meta == nil { return "" } + repositoryName := meta.Repository.Name if len(meta.Vtags) == 0 { - return meta.Repository.Name + return repositoryName } - if len(meta.Vtags) <= 5 { - return meta.Repository.Name + ":[" + strings.Join(meta.Vtags, ",") + "]" + if len(meta.Vtags) == 1 { + return repositoryName + ":[" + meta.Vtags[0] + "]" } - return fmt.Sprintf("%s:[%s ... %d in total]", meta.GetResourceName(), strings.Join(meta.Vtags[:5], ","), len(meta.Vtags)) + return fmt.Sprintf("%s:[%s ... %d in total]", repositoryName, meta.Vtags[0], len(meta.Vtags)) } // repository:c namespace:n -> n/c