diff --git a/source/app/metrics/utils.mjs b/source/app/metrics/utils.mjs index 1a6d25fe..810afaae 100644 --- a/source/app/metrics/utils.mjs +++ b/source/app/metrics/utils.mjs @@ -102,6 +102,13 @@ export function formatters({timeZone} = {}) { return new Intl.DateTimeFormat("en-GB", {timeZone, ...options}).format(new Date(string)) } + /**License formatter */ + format.license = function(license) { + if (license.spdxId === "NOASSERTION") + return license.name + return license.nickname ?? license.spdxId ?? license.name + } + return {format} } diff --git a/source/templates/classic/partials/stars.ejs b/source/templates/classic/partials/stars.ejs index 1edb2f51..70950202 100644 --- a/source/templates/classic/partials/stars.ejs +++ b/source/templates/classic/partials/stars.ejs @@ -39,7 +39,7 @@ <% if (repository.licenseInfo) { %>
- <%= repository.licenseInfo.nickname ?? repository.licenseInfo.spdxId ?? repository.licenseInfo.name %> + <%= f.license(repository.licenseInfo) %>
<% } %>