From fa8d367e669a2997dbe43dc56ab9220d6b6aa9f6 Mon Sep 17 00:00:00 2001 From: Mohammad Ranjbar Z Date: Mon, 13 Sep 2021 17:07:04 +0430 Subject: [PATCH] Fix regex when checking trace title not to be repetitive related to Giveth/feathers-giveth#498 --- src/services/TraceService.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/TraceService.js b/src/services/TraceService.js index 75a92b18d..272b8082d 100644 --- a/src/services/TraceService.js +++ b/src/services/TraceService.js @@ -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,