diff options
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r-- | apps/files_trashbin/lib/trashbin.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index 839a47a7bf2..9eada31f5df 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -41,6 +41,7 @@ use OC\Files\Filesystem; use OC\Files\View; use OCA\Files_Trashbin\AppInfo\Application; use OCA\Files_Trashbin\Command\Expire; +use OCP\Files\NotFoundException; class Trashbin { @@ -64,15 +65,24 @@ class Trashbin { self::getUidAndFilename($params['path']); } + /** + * @param string $filename + * @return array + * @throws \OC\User\NoUserException + */ public static function getUidAndFilename($filename) { $uid = \OC\Files\Filesystem::getOwner($filename); \OC\Files\Filesystem::initMountPoints($uid); if ($uid != \OCP\User::getUser()) { $info = \OC\Files\Filesystem::getFileInfo($filename); $ownerView = new \OC\Files\View('/' . $uid . '/files'); - $filename = $ownerView->getPath($info['fileid']); + try { + $filename = $ownerView->getPath($info['fileid']); + } catch (NotFoundException $e) { + $filename = null; + } } - return array($uid, $filename); + return [$uid, $filename]; } /** |