diff --git a/CHANGELOG.md b/CHANGELOG.md index 18c51f2b..a84777e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added - New --partwipe flag for profile and node set +- Updated arguments for `ValidString` to match `regexp.MatchString` ## v4.6.5, 2026-01-12 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ddb558cc..94393a59 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -51,3 +51,4 @@ - Adrian Reber - Karker Said [@kosmolito](https://github.com/kosmolito) - Jason Scott @jsco2t +- Sujeev Uthayakumar [@Sujeev-Uthayakumar](https://github.com/Sujeev-Uthayakumar) diff --git a/internal/pkg/image/util.go b/internal/pkg/image/util.go index 6519a457..f5cd6e5e 100644 --- a/internal/pkg/image/util.go +++ b/internal/pkg/image/util.go @@ -12,7 +12,7 @@ import ( ) func ValidName(name string) bool { - if !util.ValidString(name, "^[\\w\\-\\.\\:]+$") { + if !util.ValidString("^[\\w\\-\\.\\:]+$", name) { wwlog.Warn("Image name has illegal characters: %s", name) return false } diff --git a/internal/pkg/overlay/overlay.go b/internal/pkg/overlay/overlay.go index 79342ea9..516ee44f 100644 --- a/internal/pkg/overlay/overlay.go +++ b/internal/pkg/overlay/overlay.go @@ -961,7 +961,7 @@ func BuildOverlayIndir(nodeData node.Node, allNodes []node.Node, overlayNames [] return fmt.Errorf("output must a be a directory: %s", outputDir) } - if !util.ValidString(strings.Join(overlayNames, ""), "^[a-zA-Z0-9-._:]+$") { + if !util.ValidString("^[a-zA-Z0-9-._:]+$", strings.Join(overlayNames, "")) { return fmt.Errorf("overlay names contains illegal characters: %v", overlayNames) } diff --git a/internal/pkg/upgrade/util.go b/internal/pkg/upgrade/util.go index 188db6e1..5bae07a9 100644 --- a/internal/pkg/upgrade/util.go +++ b/internal/pkg/upgrade/util.go @@ -27,7 +27,7 @@ func legacyKernelVersionFile(kernelName string) string { return "" } - if !util.ValidString(kernelName, "^[a-zA-Z0-9-._]+$") { + if !util.ValidString("^[a-zA-Z0-9-._]+$", kernelName) { return "" } diff --git a/internal/pkg/util/util.go b/internal/pkg/util/util.go index de6945a2..a999c195 100644 --- a/internal/pkg/util/util.go +++ b/internal/pkg/util/util.go @@ -129,8 +129,8 @@ func ReadFile(path string) ([]string, error) { return lines, nil } -func ValidString(pattern string, expr string) bool { - if b, _ := regexp.MatchString(expr, pattern); b { +func ValidString(pattern string, s string) bool { + if b, _ := regexp.MatchString(pattern, s); b { return true } return false