A licence left out by its name stays out once its entry gives an id
CI / test (push) Failing after 6m30s
CI / test (push) Failing after 6m30s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
4bbac0833d
commit
587d8d5059
2 files changed
+12
-1
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user