Skip to content

Commit d3554ef

Browse files
committed
Sanitize input and names before running the query
1 parent 965cc47 commit d3554ef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/containers/UsersList.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ export class UsersList extends Component {
7070

7171
handleSearchInput = e => {
7272
const users = this.props.users.filter(user => {
73-
const name = `${user.first_name} ${user.last_name}`
73+
const name = this.sanitizeInput(`${user.first_name} ${user.last_name}`)
74+
const query = this.sanitizeInput(e.target.value)
7475

75-
return name.includes(e.target.value)
76+
return name.includes(query)
7677
})
7778

7879
this.normalizeUsers(users)

0 commit comments

Comments
 (0)