diff --git a/lib/Controller/QueueController.php b/lib/Controller/QueueController.php index 59ae152..301398e 100644 --- a/lib/Controller/QueueController.php +++ b/lib/Controller/QueueController.php @@ -290,12 +290,17 @@ private function getFileSource(QueueFile $document, IRootFolder $rootFolder, Sto if (empty($mounts)) { throw new \Exception('Couldn\'t find any mounts for this storage'); } - $userId = $mounts[0]->getUser()->getUID(); - - try { - $file = $rootFolder->getUserFolder($userId)->getFirstNodeById($document->getFileId()); - } catch (NotPermittedException $e) { - throw new \Exception('Not allowed to get user folder'); + $file = null; + foreach ($mounts as $mount) { + $userId = $mount->getUser()->getUID(); + try { + $file = $rootFolder->getUserFolder($userId)->getFirstNodeById($document->getFileId()); + } catch (NotPermittedException $e) { + throw new \Exception('Not allowed to get user folder'); + } + if ($file instanceof File) { + break; + } } if (!($file instanceof File)) { throw new \Exception('File not found or not a file');