summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib/trashbin.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/lib/trashbin.php')
-rw-r--r--apps/files_trashbin/lib/trashbin.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php
index 839a47a7bf2..8f0fe745a45 100644
--- a/apps/files_trashbin/lib/trashbin.php
+++ b/apps/files_trashbin/lib/trashbin.php
@@ -12,7 +12,7 @@
* @author Qingping Hou <dave2008713@gmail.com>
* @author Robin Appelman <icewind@owncloud.com>
* @author Robin McCorkell <rmccorkell@karoshi.org.uk>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
+ * @author Roeland Jago Douma <rullzer@owncloud.com>
* @author Sjors van der Pluijm <sjors@desjors.nl>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Victor Dubiniuk <dubiniuk@owncloud.com>
@@ -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];
}
/**