tango-app-api-task 3.7.25 → 3.7.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-task",
3
- "version": "3.7.25",
3
+ "version": "3.7.26",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1104,11 +1104,12 @@ export async function taskDetails( req, res ) {
1104
1104
  },
1105
1105
  ];
1106
1106
 
1107
- if ( req.body?.searchValue.trim().length ) {
1107
+ if ( req.body?.searchValue?.trim()?.length ) {
1108
+ const safeSearch = escapeRegex( req.body?.searchValue );
1108
1109
  query.push(
1109
1110
  {
1110
1111
  $match: {
1111
- checkListName: { $regex: req.body.searchValue, $options: 'i' },
1112
+ checkListName: { $regex: safeSearch, $options: 'i' },
1112
1113
  },
1113
1114
  },
1114
1115
  );
@@ -1172,3 +1173,6 @@ export async function taskDetails( req, res ) {
1172
1173
  return res.sendError( e, 500 );
1173
1174
  }
1174
1175
  }
1176
+ function escapeRegex( text ) {
1177
+ return text.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' );
1178
+ }