catalog-backend: make type comparison lowercase

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2025-09-15 11:50:34 +02:00
parent 0364b9f107
commit 62bb3b75d0
@@ -222,12 +222,23 @@ export class DefaultCatalogRulesEnforcer implements CatalogRulesEnforcer {
}
for (const matcher of matchers) {
if (entity.kind?.toLowerCase() !== matcher.kind.toLowerCase()) {
if (
entity.kind?.toLocaleLowerCase('en-US') !==
matcher.kind.toLocaleLowerCase('en-US')
) {
continue;
}
if (matcher['spec.type'] && matcher['spec.type'] !== entity.spec?.type) {
continue;
if (matcher['spec.type']) {
if (typeof entity.spec?.type !== 'string') {
continue;
}
if (
matcher['spec.type'].toLocaleLowerCase('en-US') !==
entity.spec.type.toLocaleLowerCase('en-US')
) {
continue;
}
}
return true;