-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Error while searching Patient #1999
Comments
Thanks for the report @akshay-ap. Confirmed that this is an issue. Seems like we should validate the characters in the search field. |
I've got a fix that simply removes any backslashes, to avoid escaping the regexp. Does it need a wider-ranging check for other characters, or maybe just remove anything other than A-Z...? PatientRepository.ts - Line 16 added, line 22 modified to replace 'text' with 'cleanText':
Either way, happy to take this one on if it's free. |
The issue seems to be with string ending with any special characters in regex like |
Ah, I thought it was just the backslash. I'll write a general case solution to remove anything that's not whitespace or alphabetical if Jack assigns me to the bug. Is it better to fix as shown, by cleaning the search string, or by stopping the text field from accepting any disallowed characters in the first place? |
@JDarke I've assigned this to you. |
Do international alphabetical characters need to be factored in to this, or is localisation being handled separately? |
Added a step to take the search string and remove all non-letter/whitespace characters. Line 16 and 22 fix HospitalRun#1999
Added a step to remove all non-alphabetical and whitespace characters from search string regex fix HospitalRun#1999
international characters should be handled here. numbers, apostrophes, and other characters found in a name should also be supported. |
Will do. |
@akshay-ap ...I've run through numerous special characters, and so far my list of chars that break the search is as follows:
Does this cover all the instances you experienced? |
@JDarke I think that we can safely remove all of those characters you listed. |
Removed special chars that interfered with RegExp in search strings re HospitalRun#1999
Ok, those are all removed in my last commit. I think this should also be addressed at the Add New Patient input stage, too; currently it's possible to create a patient with a name containing those special characters, which the user will now not be able to accurately search for. Separate issue to be raised, or to be included with this issue? |
Added a test to pass a search string including all prohibited chars, expects cleaned version of string to be used for search. re HospitalRun#1999
Added test on the search string cleaning regex; runs search string containing all prohibited chars, expects cleaned version to be searched and matched re HospitalRun#1999
Removing mocha listed dependency added in error re HospitalRun#1999
Added escapeStringRegexp package to escape special chars in search string for p fix HospitalRun#1999
🐛 Bug Report
A clear and concise description of what the bug is.
To Reproduce
Expected behavior
No error.
Your Environment
The text was updated successfully, but these errors were encountered: