throw exception if encryption was disabled but files are still encrypted to prevent the client from syncing unreadable files

This commit is contained in:
Bjoern Schiessle 2013-08-14 09:44:29 +02:00
parent 53bb89824d
commit 6c3efaf26c
1 changed files with 11 additions and 1 deletions

View File

@ -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');
}
}