Skip to content

Commit 4502522

Browse files
itsmelouisatinux
andauthored
fix(server): guard collection lookup against prototype keys (#488)
Co-authored-by: Sébastien Chopin <[email protected]>
1 parent 931722e commit 4502522

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/runtime/server/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function getInstallCommand(pkg: string): string {
2323
export default defineCachedEventHandler(async (event: H3Event) => {
2424
const options = useAppConfig().icon as NuxtIconRuntimeOptions
2525
const collectionName = event.context.params?.collection?.replace(/\.json$/, '')
26-
const collection = collectionName
26+
const collection = collectionName && Object.hasOwn(collections, collectionName)
2727
? await collections[collectionName]?.()
2828
: null
2929

0 commit comments

Comments
 (0)