Skip to content

Commit

Permalink
Fix mongo query for null value
Browse files Browse the repository at this point in the history
Due to an optimistic type change earlier in the upgrade it was
possible here to send through an empty string which angers Mongo.
Since we've typed the var strictly to a string we can check here
for an empty string explicitly.
  • Loading branch information
Sinetheta committed Sep 4, 2024
1 parent f942b93 commit 03d6470
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/api/blueprint-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ export class BlueprintController {

let filter: any = { $and: [{ createdAt: { $lt: dateFilter } }, { deleted: { $ne: true } }] };

if (filterUserId != null) filter.$and.push({ owner: filterUserId });
if (filterName != null) filter.$and.push({ name: { $regex: filterName, $options: 'i' } });
if (filterUserId != '') filter.$and.push({ owner: filterUserId });
if (filterName != '') filter.$and.push({ name: { $regex: filterName, $options: 'i' } });
if (!getDuplicates) filter.$and.push({ $or: [{ isCopy: null }, { isCopy: false }] });

let browseIncrement = parseInt(process.env.BROWSE_INCREMENT as string);
Expand Down

0 comments on commit 03d6470

Please sign in to comment.