Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Commit

Permalink
Fix regex when checking trace title not to be repetitive
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadranjbarz committed Sep 13, 2021
1 parent f547e36 commit fa8d367
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/services/TraceService.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,11 @@ class TraceService {
const query = {
campaignId: trace.campaignId,
title: {
$regex: `\\s*${trace.title.replace(/^\s+|\s+$|\s+(?=\s)/g, '')}\\s*`,
/**
* The regex should be exactly like we use in feathers-giveth
* @see{@link https://github.com/Giveth/feathers-giveth/blob/develop/src/utils/regexUtils.js#L2}
*/
$regex: `^\\s*${trace.title.replace(/^\s+|\s+$|\s+(?=\s)/g, '')}\\s*$`,
$options: 'i',
},
$limit: 1,
Expand Down

0 comments on commit fa8d367

Please sign in to comment.