File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ async function runFindTriggers(
3434 options = { }
3535) {
3636 const { isGet } = options ;
37+
3738 // Run beforeFind trigger - may modify query or return objects directly
3839 const result = await triggers . maybeRunQueryTrigger (
3940 triggers . Types . beforeFind ,
@@ -58,18 +59,11 @@ async function runFindTriggers(
5859
5960 // Security check: Re-filter objects if not master to ensure ACL/CLP compliance
6061 if ( ! auth ?. isMaster && ! auth ?. isMaintenance ) {
61- const inputArray = Array . isArray ( objectsFromBeforeFind )
62- ? objectsFromBeforeFind
63- : [ objectsFromBeforeFind ] ;
64-
65- const ids = inputArray
62+ const ids = ( Array . isArray ( objectsFromBeforeFind ) ? objectsFromBeforeFind : [ objectsFromBeforeFind ] )
6663 . map ( o => ( o && ( o . id || o . objectId ) ) || null )
6764 . filter ( Boolean ) ;
6865
69- // If no valid ids are present, do not return unsanitized data
70- if ( ids . length === 0 ) {
71- objectsForAfterFind = [ ] ;
72- } else {
66+ if ( ids . length > 0 ) {
7367 const refilterWhere = isGet ? { objectId : ids [ 0 ] } : { objectId : { $in : ids } } ;
7468
7569 // Re-query with proper security: no triggers to avoid infinite loops
You can’t perform that action at this time.
0 commit comments