Skip to content

Commit 26b9761

Browse files
fix(server): filter noncommercial license tokens in speech catalogs
1 parent f92847a commit 26b9761

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎apps/server/scripts/speech-catalog.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ it("filters roles, explicit NC licenses, future engines, unknown architectures a
4444
{ license: "cc-by-nc-4.0" },
4545
{ license: "CC-BY-NC-SA-4.0" },
4646
{ license: "cc-by-nc-nd-3.0" },
47+
{ license: "cc-by-nc" },
48+
{ license: "CC BY-NC 4.0" },
49+
{ license: "custom_NC" },
4750
{ minEngine: "0.4.2" },
4851
{ minEngine: "0.5.0" },
4952
{ family: "future_arch" },
@@ -57,7 +60,7 @@ it("filters roles, explicit NC licenses, future engines, unknown architectures a
5760
]) {
5861
expect(generate([{ ...model, ...override }]).models).toEqual([]);
5962
}
60-
for (const license of ["other", "apache-2.0", "cc-by-4.0", "cc-by-sa-4.0"]) {
63+
for (const license of ["other", "apache-2.0", "cc-by-4.0", "cc-by-sa-4.0", "unlicense"]) {
6164
expect(generate([{ ...model, license, minEngine: "0.4.1" }]).models).toHaveLength(1);
6265
}
6366
});

‎apps/server/scripts/speech-catalog.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function generateSpeechCatalog(
5050
const models = data.models.flatMap((model) => {
5151
if (
5252
model.role !== "asr" ||
53-
/^cc-by-nc(?:-sa|-nd)?-\d+\.\d+$/i.test(model.license.trim()) ||
53+
/(?:^|[^a-z0-9])nc(?:$|[^a-z0-9])/i.test(model.license) ||
5454
!ASR_FAMILIES.has(model.family) ||
5555
compareEngineVersions(model.minEngine ?? data.transcribeCpp, engineVersion) > 0
5656
)

0 commit comments

Comments
 (0)