diff --git a/cmd/hauler/cli/store/create_manifest.go b/cmd/hauler/cli/store/create_manifest.go index 2457b50..0905ad8 100644 --- a/cmd/hauler/cli/store/create_manifest.go +++ b/cmd/hauler/cli/store/create_manifest.go @@ -182,7 +182,7 @@ func CreateManifestCmd(ctx context.Context, o *flags.CreateManifestOpts, s *stor return fmt.Errorf("store contains no content to build a manifest from") } - base := sanitizeName(filepath.Base(s.Root)) + base := filepath.Base(s.Root) output := o.Output if output == "" { @@ -287,23 +287,3 @@ func decodeOriginalChartRef(v string) (repoURL string, total string) { } return repoURL, total } - -// sanitizeName lowercases s and replaces any character outside [a-z0-9-] with '-' so -// the result is safe to use as a Kubernetes-style object name. -func sanitizeName(s string) string { - s = strings.ToLower(s) - var b strings.Builder - for _, r := range s { - switch { - case r >= 'a' && r <= 'z', r >= '0' && r <= '9', r == '-': - b.WriteRune(r) - default: - b.WriteRune('-') - } - } - out := strings.Trim(b.String(), "-") - if out == "" { - return "store" - } - return out -} diff --git a/cmd/hauler/cli/store/create_manifest_test.go b/cmd/hauler/cli/store/create_manifest_test.go index 46f9211..1201c66 100644 --- a/cmd/hauler/cli/store/create_manifest_test.go +++ b/cmd/hauler/cli/store/create_manifest_test.go @@ -327,28 +327,6 @@ func TestCreateManifestCmd_MixedContent(t *testing.T) { } } -func TestSanitizeName(t *testing.T) { - tests := []struct { - name string - in string - want string - }{ - {name: "already valid", in: "my-store", want: "my-store"}, - {name: "uppercase lowered", in: "MyStore", want: "mystore"}, - {name: "spaces and dots replaced", in: "my store.v1", want: "my-store-v1"}, - {name: "leading and trailing separators trimmed", in: "--store--", want: "store"}, - {name: "empty string falls back to store", in: "", want: "store"}, - {name: "entirely invalid falls back to store", in: "***", want: "store"}, - } - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - if got := sanitizeName(tc.in); got != tc.want { - t.Errorf("sanitizeName(%q) = %q, want %q", tc.in, got, tc.want) - } - }) - } -} - func TestDecodeOriginalChartRef(t *testing.T) { tests := []struct { name string