From 9822199eecfb85cd9751d9cfa373a6e14c524752 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 25 Apr 2024 21:46:50 -0400 Subject: [PATCH] fix: Check if rule.entities exists before accessing keys --- bids-validator/src/validators/filenameIdentify.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bids-validator/src/validators/filenameIdentify.ts b/bids-validator/src/validators/filenameIdentify.ts index e19754205..0816cf638 100644 --- a/bids-validator/src/validators/filenameIdentify.ts +++ b/bids-validator/src/validators/filenameIdentify.ts @@ -145,9 +145,9 @@ function entitiesExtensionsInRule( ): boolean { const rule = schema[path] const fileEntities = Object.keys(context.entities) - const ruleEntities = Object.keys(rule.entities).map((key) => + const ruleEntities = rule.entities ? Object.keys(rule.entities).map((key) => lookupEntityLiteral(key, schema), - ) + ) : [] const extInRule = !rule.extensions || (rule.extensions && rule.extensions.includes(context.extension))