From eeae16be9714f7dc9f03f04b2c923a5996adbdb7 Mon Sep 17 00:00:00 2001 From: Scott Aslan Date: Wed, 15 Jan 2025 10:55:21 -0500 Subject: [PATCH] [NIFI-14151] catch error from illegal character in extension creation dialog filter (#9633) This closes #9633 --- .../filter-predicate/camel-case.search.spec.ts | 1 + .../filter-predicate/camel-case.search.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/extension-creation/filter-predicate/camel-case.search.spec.ts b/nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/extension-creation/filter-predicate/camel-case.search.spec.ts index 516f8144c68f..bf2581820d29 100644 --- a/nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/extension-creation/filter-predicate/camel-case.search.spec.ts +++ b/nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/extension-creation/filter-predicate/camel-case.search.spec.ts @@ -22,6 +22,7 @@ describe('matchesCamelCaseSearch', () => { it.each([ { value, query: '', expectedResult: false }, + { value, query: '[', expectedResult: false }, { value, query: value, expectedResult: true }, { value, query: 'Generate', expectedResult: true }, { value, query: 'GFlowFile', expectedResult: true }, diff --git a/nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/extension-creation/filter-predicate/camel-case.search.ts b/nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/extension-creation/filter-predicate/camel-case.search.ts index c9e8bf532e6a..91a221017207 100644 --- a/nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/extension-creation/filter-predicate/camel-case.search.ts +++ b/nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/extension-creation/filter-predicate/camel-case.search.ts @@ -22,5 +22,14 @@ export function matchesCamelCaseSearch(value: string, filter: string): boolean { } const joinedParts = camelCaseMatches.join('.*'); - return new RegExp(joinedParts).test(value); + + let doesMatch = false; + + try { + doesMatch = new RegExp(joinedParts).test(value) + } catch (e) { + // ignore + } + + return doesMatch; }