diff options
Diffstat (limited to 'apps/files_sharing/lib/Controller/ShareAPIController.php')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 218d854f2f1..134ff6378e7 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -628,18 +628,26 @@ class ShareAPIController extends OCSController { return $carry; }, []); + // filter out duplicate shares + $known = []; + $shares = array_filter($shares, function($share) use (&$known) { + if (in_array($share->getId(), $known)) { + return false; + } + $known[] = $share->getId(); + return true; + }); + $formatted = $miniFormatted = []; $resharingRight = false; - $known = []; foreach ($shares as $share) { - if (in_array($share->getId(), $known) || $share->getSharedWith() === $this->currentUser) { + if ($share->getSharedWith() === $this->currentUser) { continue; } try { $format = $this->formatShare($share); - $known[] = $share->getId(); $formatted[] = $format; if ($share->getSharedBy() === $this->currentUser) { $miniFormatted[] = $format; |