Skip to content

Commit

Permalink
Merge pull request #948 from OneCommunityGlobal/Peterson_fix_the_bug_…
Browse files Browse the repository at this point in the history
…after_writing_find_user_in_the_input_and_receiving_error_500

Peterson_fix_the_bug_after_writing_find_user_in_the_input_and_receivi…
  • Loading branch information
one-community authored Jun 9, 2024
2 parents 6f6fd53 + 9e16fb6 commit 34a86be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/controllers/userProfileController.js
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,6 @@ const userProfileController = function (UserProfile) {
const getUserByFullName = (req, res) => {
// Sanitize user input and escape special characters
const sanitizedFullName = escapeRegExp(req.params.fullName.trim());

// Create a regular expression to match the sanitized full name, ignoring case
const fullNameRegex = new RegExp(sanitizedFullName, 'i');

Expand All @@ -1173,6 +1172,7 @@ const userProfileController = function (UserProfile) {
if (users.length === 0) {
return res.status(404).send({ error: 'Users Not Found' });
}

res.status(200).send(users);
})
.catch((error) => res.status(500).send(error));
Expand Down

0 comments on commit 34a86be

Please sign in to comment.