diff --git a/src/internal/utils/image.go b/src/internal/utils/image.go index 729fd41ffd..29269ac865 100644 --- a/src/internal/utils/image.go +++ b/src/internal/utils/image.go @@ -1,12 +1,16 @@ package utils -import "regexp" +import ( + "regexp" -// For further explanation see https://regex101.com/library/PiL191 and https://regex101.com/r/PiL191/1 -var hostParser = regexp.MustCompile(`(?im)^([a-z0-9\-.]+\.[a-z0-9\-]+:?[0-9]*)?/?(.+)$`) + "github.com/defenseunicorns/zarf/src/internal/message" +) + +// For further explanation see https://regex101.com/r/DzfGag/1 +var hostParser = regexp.MustCompile(`(?im)^(.*):(.*/.*)`) // SwapHost Perform base url replacment without the docker libs -func SwapHost(src string, targetHost string) string { - var substitution = targetHost + "/$2" - return hostParser.ReplaceAllString(src, substitution) +func SwapHost(src, targetHost string) string { + message.Debugf("images.SwapHost(%s, %s)", src, targetHost) + return hostParser.ReplaceAllString(src, targetHost+"/$1.$2") }