]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix check for shared files inside shares
authorRobin Appelman <icewind@owncloud.com>
Tue, 10 Jun 2014 11:50:52 +0000 (13:50 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Sat, 14 Jun 2014 08:14:08 +0000 (10:14 +0200)
apps/files_sharing/lib/sharedstorage.php
lib/private/share/share.php

index 59de2dfa4c474c56c5c9e333a7f51ab9e2126180..6760538f510bbfc5d4c4afcbb68eaec7e6321de5 100644 (file)
 
 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();
index 0a4d9a913e239080c45628abffe7c7d81b3d79c7..26108a937cec6aeaf8103bf0bba99f00b024647a 100644 (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);