From 587d8d5059d2e95cba28934cd049a11f74882264 Mon Sep 17 00:00:00 2001 From: Ilker Manap Date: Sun, 11 Oct 2026 16:28:40 +0200 Subject: [PATCH] A licence left out by its name stays out once its entry gives an id Co-Authored-By: Claude Opus 5.5 (1M context) --- internal/router/licences.go | 8 +++++++- internal/router/licences_test.go | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/router/licences.go b/internal/router/licences.go index a0b92ba..0f953f8 100644 --- a/internal/router/licences.go +++ b/internal/router/licences.go @@ -41,9 +41,15 @@ func licenceExcluded(excluded []string, m catalog.Model) string { return "" } key := licenceKey(m) + // Its name too: a choice made before the entry gave an id keeps + // holding once it does. + name := key + if m.License != nil { + name = strings.ToLower(strings.TrimSpace(m.License.Name)) + } for _, e := range excluded { switch { - case strings.EqualFold(e, key): + case strings.EqualFold(e, key), strings.EqualFold(e, name): return e case e == ruleNonCommercial: if m.License != nil && m.License.Commercial != nil && !*m.License.Commercial { diff --git a/internal/router/licences_test.go b/internal/router/licences_test.go index ced7ede..b2faace 100644 --- a/internal/router/licences_test.go +++ b/internal/router/licences_test.go @@ -73,6 +73,11 @@ func TestAPersonsLicenceChoiceLeavesModelsOutOfTheirKeys(t *testing.T) { t.Errorf("mit: %d %s", code, raw) } + // A choice made by a licence's name holds once its entry gives an id. + if why := licenceExcluded([]string{"cc by-nc 4.0"}, cfg.Models[1]); why == "" { + t.Error("a choice by name did not hold against an entry with an id") + } + // The profile page is offered every licence, and the regions in play. c := rt.licenceChoices() var keys []string