diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-07-31 16:35:14 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-07-31 16:35:14 +0200 |
commit | 23e97216449ad65b4334dd68f84902ab08b0d62d (patch) | |
tree | cfb2038c229b060f872c4308b526f2edb3a4ffa3 /apps/files_encryption | |
parent | fe2937e3cd4ec24d9a53ce71d00936f8a883e43c (diff) | |
download | nextcloud-server-23e97216449ad65b4334dd68f84902ab08b0d62d.tar.gz nextcloud-server-23e97216449ad65b4334dd68f84902ab08b0d62d.zip |
use OC\Files\View to read encrypted file, so that it also works with external storages
Diffstat (limited to 'apps/files_encryption')
-rw-r--r-- | apps/files_encryption/lib/util.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 7983c829e11..979b0fac407 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -768,9 +768,6 @@ class Util { $decryptedFiles[] = array(); - // Disable proxy to prevent file being encrypted twice - \OC_FileProxy::$enabled = false; - // Encrypt unencrypted files foreach ($found['encrypted'] as $encryptedFile) { @@ -780,8 +777,14 @@ class Util { //relative to /data $rawPath = $encryptedFile['path']; + //enable proxy to use OC\Files\View to access the original file + \OC_FileProxy::$enabled = true; + // Open enc file handle for binary reading - $encHandle = fopen('crypt://' . $rawPath, 'rb'); + $encHandle = $this->view->fopen($rawPath, 'rb'); + + // Disable proxy to prevent file being encrypted again + \OC_FileProxy::$enabled = false; if ($encHandle === false) { \OCP\Util::writeLog('Encryption library', 'couldn\'t open "' . $rawPath . '", decryption failed!', \OCP\Util::FATAL); |