summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-01-22 00:41:48 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-01-22 00:41:48 +0100
commitc931eafc1f1aed9798ee26c537b1a1e00e6d8242 (patch)
tree2f389f70ae0aec41a8765365a69ae492a2e11572 /apps/files_encryption
parent4dac664002f9f66f3f2dff3525dce084badb1cb5 (diff)
parent750cff0e3e45c0356844fa0fdec37c3954fff451 (diff)
downloadnextcloud-server-c931eafc1f1aed9798ee26c537b1a1e00e6d8242.tar.gz
nextcloud-server-c931eafc1f1aed9798ee26c537b1a1e00e6d8242.zip
Merge pull request #13517 from owncloud/keymanager-storage
Bypass the view when storing encryption keys
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/lib/keymanager.php21
1 files changed, 9 insertions, 12 deletions
diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php
index 925bba578f4..9ccf0705b28 100644
--- a/apps/files_encryption/lib/keymanager.php
+++ b/apps/files_encryption/lib/keymanager.php
@@ -41,6 +41,7 @@ class Keymanager {
* read key from hard disk
*
* @param string $path to key
+ * @param \OC\Files\View $view
* @return string|bool either the key or false
*/
private static function getKey($path, $view) {
@@ -51,16 +52,14 @@ class Keymanager {
$key = self::$key_cache[$path];
} else {
- $proxyStatus = \OC_FileProxy::$enabled;
- \OC_FileProxy::$enabled = false;
+ /** @var \OCP\Files\Storage $storage */
+ list($storage, $internalPath) = $view->resolvePath($path);
- if ($view->file_exists($path)) {
- $key = $view->file_get_contents($path);
+ if ($storage->file_exists($internalPath)) {
+ $key = $storage->file_get_contents($internalPath);
self::$key_cache[$path] = $key;
}
- \OC_FileProxy::$enabled = $proxyStatus;
-
}
return $key;
@@ -77,14 +76,12 @@ class Keymanager {
* @return bool
*/
private static function setKey($path, $name, $key, $view) {
- $proxyStatus = \OC_FileProxy::$enabled;
- \OC_FileProxy::$enabled = false;
-
self::keySetPreparation($view, $path);
- $pathToKey = \OC\Files\Filesystem::normalizePath($path . '/' . $name);
- $result = $view->file_put_contents($pathToKey, $key);
- \OC_FileProxy::$enabled = $proxyStatus;
+ /** @var \OCP\Files\Storage $storage */
+ $pathToKey = \OC\Files\Filesystem::normalizePath($path . '/' . $name);
+ list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($pathToKey);
+ $result = $storage->file_put_contents($internalPath, $key);
if (is_int($result) && $result > 0) {
self::$key_cache[$pathToKey] = $key;