diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2013-03-07 17:14:34 -0500 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2013-03-07 17:14:34 -0500 |
commit | 48265643446f71abc1bf903ae822c746d5938865 (patch) | |
tree | 8a66504c8dd0997a9cc8aa7631eea834667ee20a /apps/files_sharing | |
parent | 4cb5cb9693a2b5d13905079f2ba7c6300c26d9b2 (diff) | |
parent | 0aa6c1b163c582011f695510b0048e31479eb8a4 (diff) | |
download | nextcloud-server-48265643446f71abc1bf903ae822c746d5938865.tar.gz nextcloud-server-48265643446f71abc1bf903ae822c746d5938865.zip |
Merge branch 'master' into shared-folder-etags
Conflicts:
apps/files_sharing/lib/sharedstorage.php
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/lib/share/file.php | 23 | ||||
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 19 |
2 files changed, 32 insertions, 10 deletions
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php index b5d506b173b..62948651806 100644 --- a/apps/files_sharing/lib/share/file.php +++ b/apps/files_sharing/lib/share/file.php @@ -73,7 +73,9 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { if ($format == self::FORMAT_SHARED_STORAGE) { // Only 1 item should come through for this format call return array( + 'parent' => $items[key($items)]['parent'], 'path' => $items[key($items)]['path'], + 'storage' => $items[key($items)]['storage'], 'permissions' => $items[key($items)]['permissions'], 'uid_owner' => $items[key($items)]['uid_owner'] ); @@ -140,13 +142,28 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { $source = \OCP\Share::getItemSharedWith('folder', $folder, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE); if ($source) { $source['path'] = $source['path'].substr($target, strlen($folder)); - return $source; } } else { $source = \OCP\Share::getItemSharedWith('file', $target, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE); - if ($source) { - return $source; + } + if ($source) { + if (isset($source['parent'])) { + $parent = $source['parent']; + while (isset($parent)) { + $query = \OC_DB::prepare('SELECT `parent`, `uid_owner` FROM `*PREFIX*share` WHERE `id` = ?', 1); + $item = $query->execute(array($parent))->fetchRow(); + if (isset($item['parent'])) { + $parent = $item['parent']; + } else { + $fileOwner = $item['uid_owner']; + break; + } + } + } else { + $fileOwner = $source['uid_owner']; } + $source['fileOwner'] = $fileOwner; + return $source; } \OCP\Util::writeLog('files_sharing', 'File source not found for: '.$target, \OCP\Util::ERROR); return false; diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index f1a371b1238..ffd4e5ced22 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -49,15 +49,12 @@ class Shared extends \OC\Files\Storage\Common { if (pathinfo($target, PATHINFO_EXTENSION) === 'part') { $source = \OC_Share_Backend_File::getSource(substr($target, 0, -5)); if ($source) { - $source['path'] = '/'.$source['uid_owner'].'/'.$source['path'].'.part'; + $source['path'] .= '.part'; // All partial files have delete permission $source['permissions'] |= \OCP\PERMISSION_DELETE; } } else { $source = \OC_Share_Backend_File::getSource($target); - if ($source) { - $source['path'] = '/'.$source['uid_owner'].'/'.$source['path']; - } } $this->files[$target] = $source; } @@ -72,8 +69,16 @@ class Shared extends \OC\Files\Storage\Common { private function getSourcePath($target) { $source = $this->getFile($target); if ($source) { - \OC\Files\Filesystem::initMountPoints($source['uid_owner']); - return $source['path']; + if (!isset($source['fullPath'])) { + \OC\Files\Filesystem::initMountPoints($source['fileOwner']); + $mount = \OC\Files\Mount::findByNumericId($source['storage']); + if ($mount) { + $this->files[$target]['fullPath'] = $mount->getMountPoint().$source['path']; + } else { + $this->files[$target]['fullPath'] = false; + } + } + return $this->files[$target]['fullPath']; } return false; } @@ -449,7 +454,7 @@ class Shared extends \OC\Files\Storage\Common { } $source = $this->getFile($path); if ($source) { - return $source['uid_owner']; + return $source['fileOwner']; } return false; } |