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