diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-08-22 17:59:39 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-08-22 17:59:39 +0200 |
commit | 9e1016f7d2aa7c23fc6287a563e6551809edcbe8 (patch) | |
tree | 2ec3b29c78b88581aa12df4bee3262fee939907d /lib/connector | |
parent | fed1792510ff11941765783653573f45fadc4c70 (diff) | |
parent | 02b2b5a808b135007d8d54b837e70c38f02729fd (diff) | |
download | nextcloud-server-9e1016f7d2aa7c23fc6287a563e6551809edcbe8.tar.gz nextcloud-server-9e1016f7d2aa7c23fc6287a563e6551809edcbe8.zip |
Merge branch 'master' into fixing-4343-master
Conflicts:
lib/connector/sabre/quotaplugin.php
Diffstat (limited to 'lib/connector')
-rw-r--r-- | lib/connector/sabre/file.php | 12 | ||||
-rw-r--r-- | lib/connector/sabre/objecttree.php | 2 | ||||
-rw-r--r-- | lib/connector/sabre/principal.php | 14 | ||||
-rw-r--r-- | lib/connector/sabre/quotaplugin.php | 2 |
4 files changed, 21 insertions, 9 deletions
diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php index 06ab73e3e4d..61bdcd5e0ae 100644 --- a/lib/connector/sabre/file.php +++ b/lib/connector/sabre/file.php @@ -50,6 +50,11 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D throw new \Sabre_DAV_Exception_Forbidden(); } + // throw an exception if encryption was disabled but the files are still encrypted + if (\OC_Util::encryptedFiles()) { + throw new \Sabre_DAV_Exception_ServiceUnavailable(); + } + // mark file as partial while uploading (ignored by the scanner) $partpath = $this->path . '.part'; @@ -89,7 +94,12 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D */ public function get() { - return \OC\Files\Filesystem::fopen($this->path, 'rb'); + //throw execption if encryption is disabled but files are still encrypted + if (\OC_Util::encryptedFiles()) { + throw new \Sabre_DAV_Exception_ServiceUnavailable(); + } else { + return \OC\Files\Filesystem::fopen($this->path, 'rb'); + } } diff --git a/lib/connector/sabre/objecttree.php b/lib/connector/sabre/objecttree.php index c4ddcbecbb8..b298813a202 100644 --- a/lib/connector/sabre/objecttree.php +++ b/lib/connector/sabre/objecttree.php @@ -88,7 +88,7 @@ class ObjectTree extends \Sabre_DAV_ObjectTree { } else { Filesystem::mkdir($destination); $dh = Filesystem::opendir($source); - while ($subnode = readdir($dh)) { + while (($subnode = readdir($dh)) !== false) { if ($subnode == '.' || $subnode == '..') continue; $this->copy($source . '/' . $subnode, $destination . '/' . $subnode); diff --git a/lib/connector/sabre/principal.php b/lib/connector/sabre/principal.php index 16c88b96ea6..59a96797c16 100644 --- a/lib/connector/sabre/principal.php +++ b/lib/connector/sabre/principal.php @@ -66,13 +66,13 @@ class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend { */ public function getGroupMemberSet($principal) { // TODO: for now the group principal has only one member, the user itself - list($prefix, $name) = Sabre_DAV_URLUtil::splitPath($principal); - - $principal = $this->getPrincipalByPath($prefix); - if (!$principal) throw new Sabre_DAV_Exception('Principal not found'); + $principal = $this->getPrincipalByPath($principal); + if (!$principal) { + throw new Sabre_DAV_Exception('Principal not found'); + } return array( - $prefix + $principal['uri'] ); } @@ -88,7 +88,9 @@ class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend { $group_membership = array(); if ($prefix == 'principals') { $principal = $this->getPrincipalByPath($principal); - if (!$principal) throw new Sabre_DAV_Exception('Principal not found'); + if (!$principal) { + throw new Sabre_DAV_Exception('Principal not found'); + } // TODO: for now the user principal has only its own groups return array( diff --git a/lib/connector/sabre/quotaplugin.php b/lib/connector/sabre/quotaplugin.php index eb95a839b86..c8ce65a8576 100644 --- a/lib/connector/sabre/quotaplugin.php +++ b/lib/connector/sabre/quotaplugin.php @@ -60,7 +60,7 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin { } list($parentUri, $newName) = Sabre_DAV_URLUtil::splitPath($uri); $freeSpace = $this->fileView->free_space($parentUri); - if ($freeSpace !== \OC\Files\FREE_SPACE_UNKNOWN && $length > $freeSpace) { + if ($freeSpace !== \OC\Files\SPACE_UNKNOWN && $length > $freeSpace) { throw new Sabre_DAV_Exception_InsufficientStorage(); } } |