Skip to content

Commit

Permalink
Use strings.TrimRight to determine image name
Browse files Browse the repository at this point in the history
This is to prevent a slice bounds out of range error.

Fixes #243

Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
  • Loading branch information
relu committed Nov 4, 2021
1 parent cb53e35 commit cac285c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/update/setters.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package update

import (
"fmt"
"strings"

"github.com/go-logr/logr"
"github.com/google/go-containerregistry/pkg/name"
Expand Down Expand Up @@ -159,7 +160,7 @@ func UpdateWithSetters(tracelog logr.Logger, inpath, outpath string, policies []
// annoyingly, neither the library imported above, nor an
// alternative I found, will yield the original image name;
// this is an easy way to get it
name := image[:len(image)-len(tag)-1]
name := strings.TrimRight(image, ":"+tag)

imageSetter := fmt.Sprintf("%s:%s", policy.GetNamespace(), policy.GetName())
tracelog.Info("adding setter", "name", imageSetter)
Expand Down

0 comments on commit cac285c

Please sign in to comment.