summaryrefslogtreecommitdiffstats
path: root/lib/private/files/view.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/files/view.php')
-rw-r--r--lib/private/files/view.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 6bc1ac46ef3..19197950988 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -44,7 +44,6 @@
namespace OC\Files;
use Icewind\Streams\CallbackWrapper;
-use OC\Files\Cache\Updater;
use OC\Files\Mount\MoveableMount;
use OC\Files\Storage\Storage;
use OC\User\User;
@@ -2017,4 +2016,28 @@ class View {
}
return '';
}
+
+ /**
+ * @param string $filename
+ * @return array
+ * @throws \OC\User\NoUserException
+ * @throws NotFoundException
+ */
+ public function getUidAndFilename($filename) {
+ $info = $this->getFileInfo($filename);
+ if (!$info instanceof \OCP\Files\FileInfo) {
+ throw new NotFoundException($this->getAbsolutePath($filename) . 'not found');
+ }
+ $uid = $info->getOwner()->getUID();
+ if ($uid != \OCP\User::getUser()) {
+ Filesystem::initMountPoints($uid);
+ $ownerView = new View('/' . $uid . '/files');
+ try {
+ $filename = $ownerView->getPath($info['fileid']);
+ } catch (NotFoundException $e) {
+ throw new NotFoundException('File with id ' . $info['fileid'] . 'not found for user ' . $uid);
+ }
+ }
+ return [$uid, $filename];
+ }
}