diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-01-25 22:17:50 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-01-27 15:12:25 +0300 |
commit | 74117d916e7c458aa5ad427f5f404ab1da59043f (patch) | |
tree | 8059069b81b207331e441d0d7fb54a70beffc134 /lib | |
parent | 8b87d83cbe0b133af58a9cfcd86bc18fb7a2e1a0 (diff) |
Catch the exception when a user no longer exists
Else this could result in a lot of log spam.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Service/DocumentService.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php index 30836e9c0..730c064d9 100644 --- a/lib/Service/DocumentService.php +++ b/lib/Service/DocumentService.php @@ -343,7 +343,14 @@ class DocumentService { * @throws NotFoundException */ public function getFileById($fileId, $userId = null): Node { - $files = $this->rootFolder->getUserFolder($this->userId ?? $userId)->getById($fileId); + try { + $userFolder = $this->rootFolder->getUserFolder($this->userId ?? $userId); + } catch (\OC\User\NoUserException $e) { + // It is a bit hacky to depend on internal exceptions here. But it is the best we can do for now + throw new NotFoundException(); + } + + $files = $userFolder->getById($fileId); if (count($files) === 0) { throw new NotFoundException(); } |