diff --git a/scripts/catalog.mjs b/scripts/catalog.mjs index 98b02c8..5568948 100644 --- a/scripts/catalog.mjs +++ b/scripts/catalog.mjs @@ -126,7 +126,7 @@ function manifest(dir, id) { if (new Set(app.platforms).size !== app.platforms.length) fail(where, "platforms repeat"); address(where, app.website, "website"); address(where, app.source, "source"); - if (app.source && new URL(app.source).hostname === "github.com" && !github(app.source)) fail(where, `a GitHub source is https://github.com/owner/repo: ${app.source}`); + if (app.source && ["github.com", "www.github.com"].includes(new URL(app.source).hostname) && !github(app.source)) fail(where, `a GitHub source is https://github.com/owner/repo: ${app.source}`); if (app.website === null && app.source === null) fail(where, "website or source is required"); if (!Array.isArray(app.previews) || !app.previews.length) fail(where, "previews must be a non-empty list"); if (new Set(app.previews).size !== app.previews.length) fail(where, "previews repeat"); diff --git a/tests/catalog.test.mjs b/tests/catalog.test.mjs index fa70ec3..cc48809 100644 --- a/tests/catalog.test.mjs +++ b/tests/catalog.test.mjs @@ -61,6 +61,7 @@ const bad = [ ["an encoded host", { app: { ...good, website: "https://good.example@evil.com/" } }, /plain host/], ["a GitHub source with a trailing slash", { app: { ...good, source: "https://github.com/ada/tally/" } }, /github.com\/owner\/repo/], ["a GitHub source with a query", { app: { ...good, source: "https://github.com/ada/tally?tab=readme-ov-file" } }, /github.com\/owner\/repo/], + ["a GitHub source on www", { app: { ...good, source: "https://www.github.com/ada/tally" } }, /github.com/owner/repo/], ["a host with credentials", { app: { ...good, website: "https://good.example@evil.com/" } }, /plain host/], ["a long description", { app: { ...good, description: "a".repeat(281) } }, /281 weighted characters/], ["stars without their time", { app: { ...good, stars: 3 } }, /go together/],