Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes invalid regexp scenario #1081

Merged
merged 2 commits into from
Feb 6, 2024
Merged

Conversation

jvorcak
Copy link
Collaborator

@jvorcak jvorcak commented Feb 6, 2024

No description provided.

filteredSubjects = filteredSubjects.filter(x => uiSettings.schemaList.showSoftDeleted || (!uiSettings.schemaList.showSoftDeleted && !x.isSoftDeleted))
.filter(x => x.name.toLowerCase().match(quickSearchRegExp));
} catch (e) {
console.warn('Invalid expression')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we should handle or rethrow the error or capture the exception. Maybe we should also check that the regexp should run, if there is no uiSettings.schemaList.quickSearch for example?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@malinskibeniamin based on what I found there is no other way to check whether regexp is valid other than trying to compose it and catch with an exception. IF it's valid, we filter on it, if it's not valid, we keep the original array.

Copy link
Contributor

@malinskibeniamin malinskibeniamin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const filteredSubjects = api.schemaSubjects
.filter(x => uiSettings.schemaList.showSoftDeleted || (!uiSettings.schemaList.showSoftDeleted && !x.isSoftDeleted))
.filter(x => x.name.toLowerCase().match(quickSearchRegExp));
let filteredSubjects = api.schemaSubjects
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint?

@jvorcak jvorcak merged commit e7ee17b into master Feb 6, 2024
8 checks passed
@jvorcak jvorcak deleted the fix/fixes-invalid-regexp-scenario branch February 6, 2024 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants