Skip to content

Commit

Permalink
fix: fix regex matching for query string null/undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
PauloGoncalvesBH committed Jan 22, 2024
1 parent 74ec343 commit 67d9914
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/alterarValoresParaRegex.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { log } = require('./logger')

module.exports = queryString => {
Object.keys(queryString).forEach(key => {
if (['nome', 'password', 'descricao'].includes(key)) {
if (['nome', 'password', 'descricao'].includes(key) && queryString[key] != null) {
try {
// Add 'i' flag for case-insensitive matching
queryString[key] = new RegExp(escapeStringRegexp(queryString[key]), 'i')
Expand Down

0 comments on commit 67d9914

Please sign in to comment.