Skip to content

Commit

Permalink
Fix bug in Action List Page text search regex handling
Browse files Browse the repository at this point in the history
Introduced in 06e9a54 - after having
escaped the user provided search string for use as a regular
expression, the identifier search broke since it was not implemented
as a regular expression search but simple string matching. For example
dashes in identifiers like AB-CD-1 where not matched because they are
a special character in regex and had been escaped.
  • Loading branch information
tituomin committed Sep 30, 2024
1 parent 7db7120 commit 5589493
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions components/actions/ActionListFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -819,17 +819,11 @@ class ActionNameFilter implements ActionListFilter<string | undefined> {

filterAction(value: string, action: ActionListAction) {
const searchStr = escapeStringRegexp(value.toLowerCase());
let searchTarget = action.name.replace(/\u00AD/g, '').toLowerCase();
if (this.hasActionIdentifiers) {
if (action.identifier.toLowerCase().startsWith(searchStr)) return true;
searchTarget = `${action.identifier.toLowerCase()} ${searchTarget}`;
}
if (
action.name
.replace(/\u00AD/g, '')
.toLowerCase()
.search(searchStr) !== -1
)
return true;
return false;
return searchTarget.search(searchStr) !== -1;
}
getLabel(t: TFunction) {
return t('filter-text', this.actionTermContext);
Expand Down

0 comments on commit 5589493

Please sign in to comment.