Skip to content

Commit f27000f

Browse files
committed
Fix "object Object" shown in Licence field and on OG image
https://npmx.dev/package/g
1 parent bf0c8f7 commit f27000f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/composables/npm/usePackage.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ function transformPackument(pkg: Packument, requestedVersion?: string | null): S
6969
if (pkg.time[v]) filteredTime[v] = pkg.time[v]
7070
}
7171

72+
// Normalize license field
73+
let license = pkg.license
74+
if (license && typeof license === 'object' && 'type' in license) {
75+
license = license.type
76+
}
77+
7278
return {
7379
'_id': pkg._id,
7480
'_rev': pkg._rev,
@@ -78,7 +84,7 @@ function transformPackument(pkg: Packument, requestedVersion?: string | null): S
7884
'time': filteredTime,
7985
'maintainers': pkg.maintainers,
8086
'author': pkg.author,
81-
'license': pkg.license,
87+
'license': license,
8288
'homepage': pkg.homepage,
8389
'keywords': pkg.keywords,
8490
'repository': pkg.repository,

0 commit comments

Comments
 (0)