summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-02-26 15:32:45 +0100
committerRobin Appelman <icewind@owncloud.com>2012-02-26 15:32:45 +0100
commitff0a542e48aa5fe3adf557f17b0a9383a79bf586 (patch)
treee9ab3716db37c501387c12005288b725aad680f4 /apps/files_encryption
parentd4d09b06f80462394983fe04d291a0345dd57280 (diff)
downloadnextcloud-server-ff0a542e48aa5fe3adf557f17b0a9383a79bf586.tar.gz
nextcloud-server-ff0a542e48aa5fe3adf557f17b0a9383a79bf586.zip
always set encrypted flag when overwriting a file we should encrypt
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/lib/proxy.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index 5c83171dda2..bd98b98bbad 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -66,6 +66,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
if(self::shouldEncrypt($path)){
if (!is_resource($data)) {//stream put contents should have been converter to fopen
$data=OC_Crypt::blockEncrypt($data);
+ OC_FileCache::put($path,array('encrypted'=>true));
}
}
}
@@ -85,7 +86,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
if(self::isEncrypted($path)){
fclose($result);
$result=fopen('crypt://'.$path,$meta['mode']);
- }elseif(self::shouldEncrypt($path) and $meta['mode']!='r'){
+ }elseif(self::shouldEncrypt($path) and $meta['mode']!='r' and $meta['mode']!='rb'){
if(OC_Filesystem::file_exists($path) and OC_Filesystem::filesize($path)>0){
//first encrypt the target file so we don't end up with a half encrypted file
OC_Log::write('files_encryption','Decrypting '.$path.' before writing',OC_Log::DEBUG);