fix public preview creation if a user ios logged in

This commit is contained in:
Bjoern Schiessle 2013-11-27 18:35:52 +01:00
parent 40231c08cf
commit aee7781f22
1 changed files with 7 additions and 3 deletions

View File

@ -9,6 +9,8 @@ if(!\OC_App::isEnabled('files_sharing')){
exit;
}
\OC_User::setIncognitoMode(true);
$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : '';
$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36';
$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36';
@ -36,10 +38,12 @@ if(!isset($linkedItem['uid_owner']) || !isset($linkedItem['file_source'])) {
$userId = $linkedItem['uid_owner'];
\OC_Util::setupFS($userId);
\OC\Files\Filesystem::initMountPoints($userId);
$view = new \OC\Files\View('/' . $userId . '/files');
$pathId = $linkedItem['file_source'];
$path = \OC\Files\Filesystem::getPath($pathId);
$pathInfo = \OC\Files\Filesystem::getFileInfo($path);
$path = $view->getPath($pathId);
$pathInfo = $view->getFileInfo($path);
$sharedFile = null;
if($linkedItem['item_type'] === 'folder') {
@ -54,7 +58,7 @@ if($linkedItem['item_type'] === 'folder') {
if($linkedItem['item_type'] === 'file') {
$parent = $pathInfo['parent'];
$path = \OC\Files\Filesystem::getPath($parent);
$path = $view->getPath($parent);
$sharedFile = $pathInfo['name'];
}