Skip to content

Commit

Permalink
fix(patientrepository.ts): clean the search string of illegal chars
Browse files Browse the repository at this point in the history
Added a step to take the search string and remove all non-letter/whitespace characters. Line 16 and
22

fix HospitalRun#1999
  • Loading branch information
JDarke committed Apr 23, 2020
1 parent 7791d9e commit add9c02
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/clients/db/PatientRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ export class PatientRepository extends Repository<Patient> {
}

async search(text: string): Promise<Patient[]> {
const cleanText = text.replace(/\\/g, '')
return super.search({
selector: {
$or: [
{
fullName: {
$regex: RegExp(text, 'i'),
$regex: RegExp(cleanText, 'i'),
},
},
{
Expand Down

0 comments on commit add9c02

Please sign in to comment.