Fix check for shared files inside shares

This commit is contained in:
Robin Appelman 2014-06-10 13:50:52 +02:00 committed by Bjoern Schiessle
parent 790d51ea1e
commit c61f759a8b
2 changed files with 5 additions and 4 deletions

View file

@ -23,12 +23,13 @@
namespace OC\Files\Storage;
use OC\Files\Filesystem;
use OCA\Files_Sharing\ISharedStorage;
use OCA\Files_Sharing\SharedMount;
/**
* Convert target path to source path and pass the function call to the correct storage provider
*/
class Shared extends \OC\Files\Storage\Common {
class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
private $share; // the shared resource
private $files = array();

View file

@ -508,9 +508,9 @@ class Share extends \OC\Share\Constants {
if ($itemType === 'folder') {
$path = '/' . $uidOwner . '/files' . \OC\Files\Filesystem::getPath($itemSource) . '/';
$mountManager = \OC\Files\Filesystem::getMountManager();
$mounts = $mountManager->getAll();
foreach ($mounts as $mountPoint => $mount) {
if ($mount->getStorage() instanceof \OCA\Files_Sharing\ISharedStorage && strpos($mountPoint, $path) === 0) {
$mounts = $mountManager->findIn($path);
foreach ($mounts as $mount) {
if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) {
$message = 'Sharing "' . $itemSourceName . '" failed, because it contains files shared with you!';
\OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
throw new \Exception($message);