From 3cb07b3ac9e2c40e789a76bda6b4fa2558c579ab Mon Sep 17 00:00:00 2001 From: Blake Mizerany Date: Fri, 5 Apr 2024 21:33:56 -0700 Subject: [PATCH] x/model: preserve build casing --- x/model/name.go | 2 +- x/model/name_test.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/x/model/name.go b/x/model/name.go index ccc80ad4..755a7857 100644 --- a/x/model/name.go +++ b/x/model/name.go @@ -134,7 +134,7 @@ func ParseName(s string) Name { case Tag: r.tag = part case Build: - r.build = strings.ToUpper(part) + r.build = part case Invalid: return Name{} } diff --git a/x/model/name_test.go b/x/model/name_test.go index 6aaf804c..bf8d3b41 100644 --- a/x/model/name_test.go +++ b/x/model/name_test.go @@ -15,12 +15,15 @@ var testNames = map[string]Name{ "mistral:7b+Q4_0": {model: "mistral", tag: "7b", build: "Q4_0"}, "mistral+KQED": {model: "mistral", build: "KQED"}, "mistral.x-3:7b+Q4_0": {model: "mistral.x-3", tag: "7b", build: "Q4_0"}, - "mistral:7b+q4_0": {model: "mistral", tag: "7b", build: "Q4_0"}, + "mistral:7b+q4_0": {model: "mistral", tag: "7b", build: "q4_0"}, "llama2": {model: "llama2"}, "user/model": {namespace: "user", model: "model"}, "example.com/ns/mistral:7b+Q4_0": {host: "example.com", namespace: "ns", model: "mistral", tag: "7b", build: "Q4_0"}, "example.com/ns/mistral:7b+x": {host: "example.com", namespace: "ns", model: "mistral", tag: "7b", build: "X"}, + // preserves case for build + "x+b": {model: "x", build: "b"}, + // invalid (includes fuzzing trophies) " / / : + ": {}, " / : + ": {},