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

[FIX] Invalid regex on search fields crashes UI #27942

Merged
merged 9 commits into from
Feb 13, 2023

Conversation

heitortanoue
Copy link
Contributor

@heitortanoue heitortanoue commented Feb 2, 2023

Problem to be solved

Admin -> Workspace -> Users entering ? or another invalid regular expression into the search blank crashes the UI instantly.
Other Admin pages with Regex searches have shown the same error:

  1. Custom Emoji
  2. Custom Sounds
  3. Custom User Status
  4. Integrations

Acceptance criteria

These search fields should accept valid RegEx and regular text, but showing an error message when an invalid input is given.

TC-418 TC-384

@heitortanoue heitortanoue requested a review from a team as a code owner February 2, 2023 19:30
@codecov
Copy link

codecov bot commented Feb 2, 2023

Codecov Report

Merging #27942 (f8856cb) into develop (b08adc9) will increase coverage by 0.08%.
The diff coverage is n/a.

❗ Current head f8856cb differs from pull request most recent head d98244d. Consider uploading reports for the commit d98244d to get more accurate results

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #27942      +/-   ##
===========================================
+ Coverage    41.60%   41.68%   +0.08%     
===========================================
  Files          833      833              
  Lines        17125    17125              
  Branches      2068     2068              
===========================================
+ Hits          7124     7138      +14     
+ Misses        9729     9708      -21     
- Partials       272      279       +7     
Flag Coverage Δ
e2e 41.68% <ø> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@gabriellsh gabriellsh left a comment

Choose a reason for hiding this comment

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

Is there a possibility we could use
import { escapeRegExp } from '@rocket.chat/string-helpers';
instead of testing the regex? I think this would ensure no regex would break ever...

@hugocostadev
Copy link
Contributor

I agree with @gabriellsh , there is a setting that you can change the accepted chars in the username, because of that we don't have to restrict the search for certain chars.

hugocostadev
hugocostadev previously approved these changes Feb 9, 2023
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Feb 13, 2023
@kodiakhq kodiakhq bot merged commit d989e3a into develop Feb 13, 2023
@kodiakhq kodiakhq bot deleted the fix/admin-user-regex-crash branch February 13, 2023 23:14
@sampaiodiego sampaiodiego mentioned this pull request Feb 17, 2023
@sampaiodiego sampaiodiego mentioned this pull request Mar 9, 2023
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
squad: team-collab stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants