diff options
author | icewind1991 <robin@icewind.nl> | 2014-04-29 11:22:11 +0200 |
---|---|---|
committer | icewind1991 <robin@icewind.nl> | 2014-04-29 11:22:11 +0200 |
commit | b95aa43a5d1dac3e1ca8f3c55e050861d7a4938b (patch) | |
tree | 1f1ccb1e80b888ab4cde9c294fff439487c7549b | |
parent | 158b870589b45f460334c6f9dbe7ec673c6ba138 (diff) | |
parent | 77e3d067f03ba334fc1b06f8d2177006ef859822 (diff) | |
download | nextcloud-server-b95aa43a5d1dac3e1ca8f3c55e050861d7a4938b.tar.gz nextcloud-server-b95aa43a5d1dac3e1ca8f3c55e050861d7a4938b.zip |
Merge pull request #8285 from owncloud/better_getmountby_handling
Handle return values better from Filesystem::getMountBy*
-rw-r--r-- | apps/files_sharing/lib/cache.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 3 | ||||
-rw-r--r-- | lib/private/share/share.php | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index 8c680e9c977..6e5bc04c82f 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -54,7 +54,7 @@ class Shared_Cache extends Cache { if (isset($source['path']) && isset($source['fileOwner'])) { \OC\Files\Filesystem::initMountPoints($source['fileOwner']); $mounts = \OC\Files\Filesystem::getMountByNumericId($source['storage']); - if (is_array($mounts) and count($mounts)) { + if (is_array($mounts) and !empty($mounts)) { $fullPath = $mounts[0]->getMountPoint() . $source['path']; list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($fullPath); if ($storage) { diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 5e478d5ead8..2252ec6a1a6 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -87,10 +87,11 @@ class Shared extends \OC\Files\Storage\Common { if (!isset($source['fullPath'])) { \OC\Files\Filesystem::initMountPoints($source['fileOwner']); $mount = \OC\Files\Filesystem::getMountByNumericId($source['storage']); - if (is_array($mount)) { + if (is_array($mount) && !empty($mount)) { $this->files[$target]['fullPath'] = $mount[key($mount)]->getMountPoint() . $source['path']; } else { $this->files[$target]['fullPath'] = false; + \OCP\Util::writeLog('files_sharing', "Unable to get mount for shared storage '" . $source['storage'] . "' user '" . $source['fileOwner'] . "'", \OCP\Util::ERROR); } } return $this->files[$target]['fullPath']; diff --git a/lib/private/share/share.php b/lib/private/share/share.php index c0ce3a1d8af..b12d62e8439 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -1228,7 +1228,7 @@ class Share extends \OC\Share\Constants { } else { if (!isset($mounts[$row['storage']])) { $mountPoints = \OC\Files\Filesystem::getMountByNumericId($row['storage']); - if (is_array($mountPoints)) { + if (is_array($mountPoints) && !empty($mountPoints)) { $mounts[$row['storage']] = current($mountPoints); } } |