Merge pull request #13517 from owncloud/keymanager-storage
Bypass the view when storing encryption keys
This commit is contained in:
commit
c931eafc1f
|
@ -41,6 +41,7 @@ class Keymanager {
|
||||||
* read key from hard disk
|
* read key from hard disk
|
||||||
*
|
*
|
||||||
* @param string $path to key
|
* @param string $path to key
|
||||||
|
* @param \OC\Files\View $view
|
||||||
* @return string|bool either the key or false
|
* @return string|bool either the key or false
|
||||||
*/
|
*/
|
||||||
private static function getKey($path, $view) {
|
private static function getKey($path, $view) {
|
||||||
|
@ -51,16 +52,14 @@ class Keymanager {
|
||||||
$key = self::$key_cache[$path];
|
$key = self::$key_cache[$path];
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$proxyStatus = \OC_FileProxy::$enabled;
|
/** @var \OCP\Files\Storage $storage */
|
||||||
\OC_FileProxy::$enabled = false;
|
list($storage, $internalPath) = $view->resolvePath($path);
|
||||||
|
|
||||||
if ($view->file_exists($path)) {
|
if ($storage->file_exists($internalPath)) {
|
||||||
$key = $view->file_get_contents($path);
|
$key = $storage->file_get_contents($internalPath);
|
||||||
self::$key_cache[$path] = $key;
|
self::$key_cache[$path] = $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
\OC_FileProxy::$enabled = $proxyStatus;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $key;
|
return $key;
|
||||||
|
@ -77,14 +76,12 @@ class Keymanager {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private static function setKey($path, $name, $key, $view) {
|
private static function setKey($path, $name, $key, $view) {
|
||||||
$proxyStatus = \OC_FileProxy::$enabled;
|
|
||||||
\OC_FileProxy::$enabled = false;
|
|
||||||
|
|
||||||
self::keySetPreparation($view, $path);
|
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) {
|
if (is_int($result) && $result > 0) {
|
||||||
self::$key_cache[$pathToKey] = $key;
|
self::$key_cache[$pathToKey] = $key;
|
||||||
|
|
Loading…
Reference in New Issue