\r
// if a folder was shared, get a list of all (sub-)folders\r
if ($params['itemType'] === 'folder') {\r
+\r
+ // get the path including mount point only if not a shared folder\r
+ if(strncmp($path, '/Shared' , strlen('/Shared') !== 0)) {\r
+ // get path including the the storage mount point\r
+ $path = $util->getPathWithMountPoint($params['itemSource']);\r
+ }\r
+\r
$allFiles = $util->getAllFiles($path);\r
} else {\r
$allFiles = array($path);\r
\r
// if we unshare a folder we need a list of all (sub-)files\r
if ( $params['itemType'] === 'folder' ) {\r
- \r
+\r
+ // get the path including mount point only if not a shared folder\r
+ if(strncmp($path, '/Shared' , strlen('/Shared') !== 0)) {\r
+ // get path including the the storage mount point\r
+ $path = $util->getPathWithMountPoint($params['itemSource']);\r
+ }\r
+\r
$allFiles = $util->getAllFiles( $path );\r
\r
} else {\r
$result = array();
- $content = $this->view->getDirectoryContent($this->userFilesDir . $dir);
+ $content = $this->view->getDirectoryContent(\OC\Files\Filesystem::normalizePath($this->userFilesDir . '/' . $dir));
// handling for re shared folders
$path_split = explode('/', $dir);
$this->recoverAllFiles('/', $privateKey);
}
+ /**
+ * Get the path including the storage mount point
+ * @param int $id
+ * @return string the path including the mount point like AmazonS3/folder/file.txt
+ */
+ public function getPathWithMountPoint($id) {
+ list($storage, $internalPath) = \OC\Files\Cache\Cache::getById($id);
+ $mount = \OC\Files\Filesystem::getMountByStorageId($storage);
+ $mountPoint = $mount[0]->getMountPoint();
+ $path = \OC\Files\Filesystem::normalizePath($mountPoint.'/'.$internalPath);
+
+ // reformat the path to be relative e.g. /user/files/folder becomes /folder/
+ $pathSplit = explode( '/', $path );
+ $relativePath = implode( '/', array_slice( $pathSplit, 3 ) );
+
+ return $relativePath;
+ }
+
}