Skip to content

Commit

Permalink
fix: switch to using splitN for handling annotation splitting
Browse files Browse the repository at this point in the history
Signed-off-by: Oreon Lothamer <[email protected]>
  • Loading branch information
Oreon Lothamer committed Sep 7, 2023
1 parent 8ee3967 commit 441b923
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions util/argo/resource_tracking.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,10 @@ func (rt *resourceTracking) BuildAppInstanceValue(value AppInstanceValue) string
// ParseAppInstanceValue parse resource tracking id from format <application-name>:<group>/<kind>:<namespace>/<name> to struct
func (rt *resourceTracking) ParseAppInstanceValue(value string) (*AppInstanceValue, error) {
var appInstanceValue AppInstanceValue
parts := strings.Split(value, ":")
parts := strings.SplitN(value, ":", 3)
appInstanceValue.ApplicationName = parts[0]
if len(parts) < 2 {
return nil, WrongResourceTrackingFormat
} else if len(parts) > 3 {
parts = []string{parts[0], parts[1], strings.Join(parts[2:], ":")}
}
groupParts := strings.Split(parts[1], "/")
if len(groupParts) != 2 {
Expand Down

0 comments on commit 441b923

Please sign in to comment.