From 300eb54c871cfe48165ee32ecdc5067226aa0b7b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 10 Dec 2015 14:14:54 +0100 Subject: de-deplicate getUidAndFilename --- apps/files_trashbin/lib/trashbin.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'apps/files_trashbin') diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index bd6798f0eff..874aceaad10 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -71,18 +71,7 @@ class Trashbin { * @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'); - try { - $filename = $ownerView->getPath($info['fileid']); - } catch (NotFoundException $e) { - $filename = null; - } - } - return [$uid, $filename]; + return Filesystem::getView()->getUidAndFilename($filename); } /** -- cgit v1.2.3 From 8890c88c119f9b1faaa6e60b3230561d8942973e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 14 Dec 2015 13:35:37 +0100 Subject: handle not found in trash hook --- apps/files_trashbin/lib/trashbin.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apps/files_trashbin') diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index 874aceaad10..b2fb51226c1 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -62,7 +62,11 @@ class Trashbin { * @param array $params */ public static function ensureFileScannedHook($params) { - self::getUidAndFilename($params['path']); + try { + self::getUidAndFilename($params['path']); + } catch (NotFoundException $e) { + // nothing to scan for non existing files + } } /** -- cgit v1.2.3