summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/appframework/http/dispatcher.php2
-rw-r--r--lib/private/connector/sabre/objecttree.php10
-rw-r--r--lib/private/files/mount/manager.php4
-rw-r--r--lib/private/files/storage/dav.php44
4 files changed, 41 insertions, 19 deletions
diff --git a/lib/private/appframework/http/dispatcher.php b/lib/private/appframework/http/dispatcher.php
index fa8d3c47a8b..7f2717951a5 100644
--- a/lib/private/appframework/http/dispatcher.php
+++ b/lib/private/appframework/http/dispatcher.php
@@ -145,7 +145,7 @@ class Dispatcher {
) {
$value = false;
- } elseif(in_array($type, $types)) {
+ } elseif($value !== null && in_array($type, $types)) {
settype($value, $type);
}
diff --git a/lib/private/connector/sabre/objecttree.php b/lib/private/connector/sabre/objecttree.php
index 54596db3c47..d7a96cfc88e 100644
--- a/lib/private/connector/sabre/objecttree.php
+++ b/lib/private/connector/sabre/objecttree.php
@@ -11,6 +11,8 @@ namespace OC\Connector\Sabre;
use OC\Files\FileInfo;
use OC\Files\Filesystem;
use OC\Files\Mount\MoveableMount;
+use OCP\Files\StorageInvalidException;
+use OCP\Files\StorageNotAvailableException;
class ObjectTree extends \Sabre\DAV\ObjectTree {
@@ -83,7 +85,13 @@ class ObjectTree extends \Sabre\DAV\ObjectTree {
}
} else {
// read from cache
- $info = $this->fileView->getFileInfo($path);
+ try {
+ $info = $this->fileView->getFileInfo($path);
+ } catch (StorageNotAvailableException $e) {
+ throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage not available');
+ } catch (StorageInvalidException $e){
+ throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid');
+ }
}
if (!$info) {
diff --git a/lib/private/files/mount/manager.php b/lib/private/files/mount/manager.php
index 45a9f339fba..e5180cfe173 100644
--- a/lib/private/files/mount/manager.php
+++ b/lib/private/files/mount/manager.php
@@ -27,6 +27,10 @@ class Manager {
* @param string $mountPoint
*/
public function removeMount($mountPoint) {
+ $mountPoint = Filesystem::normalizePath($mountPoint);
+ if (strlen($mountPoint) > 1) {
+ $mountPoint .= '/';
+ }
unset($this->mounts[$mountPoint]);
}
diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php
index 8b97f750204..726688fe444 100644
--- a/lib/private/files/storage/dav.php
+++ b/lib/private/files/storage/dav.php
@@ -8,6 +8,9 @@
namespace OC\Files\Storage;
+use OCP\Files\StorageNotAvailableException;
+use Sabre\DAV\Exception;
+
class DAV extends \OC\Files\Storage\Common {
protected $password;
protected $user;
@@ -463,29 +466,36 @@ class DAV extends \OC\Files\Storage\Common {
*
* @param string $path
* @param int $time
+ * @throws \OCP\Files\StorageNotAvailableException
* @return bool
*/
public function hasUpdated($path, $time) {
$this->init();
- $response = $this->client->propfind($this->encodePath($path), array(
- '{DAV:}getlastmodified',
- '{DAV:}getetag',
- '{http://owncloud.org/ns}permissions'
- ));
- if (isset($response['{DAV:}getetag'])) {
- $cachedData = $this->getCache()->get($path);
- $etag = trim($response['{DAV:}getetag'], '"');
- if ($cachedData['etag'] !== $etag) {
- return true;
- } else if (isset($response['{http://owncloud.org/ns}permissions'])) {
- $permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']);
- return $permissions !== $cachedData['permissions'];
+ try {
+ $response = $this->client->propfind($this->encodePath($path), array(
+ '{DAV:}getlastmodified',
+ '{DAV:}getetag',
+ '{http://owncloud.org/ns}permissions'
+ ));
+ if (isset($response['{DAV:}getetag'])) {
+ $cachedData = $this->getCache()->get($path);
+ $etag = trim($response['{DAV:}getetag'], '"');
+ if ($cachedData['etag'] !== $etag) {
+ return true;
+ } else if (isset($response['{http://owncloud.org/ns}permissions'])) {
+ $permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']);
+ return $permissions !== $cachedData['permissions'];
+ } else {
+ return false;
+ }
} else {
- return false;
+ $remoteMtime = strtotime($response['{DAV:}getlastmodified']);
+ return $remoteMtime > $time;
}
- } else {
- $remoteMtime = strtotime($response['{DAV:}getlastmodified']);
- return $remoteMtime > $time;
+ } catch (Exception\NotFound $e) {
+ return false;
+ } catch (Exception $e) {
+ throw new StorageNotAvailableException();
}
}
}