summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2015-03-27 11:46:07 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2015-03-27 11:51:50 +0100
commitc6be1ba8d35ceb398fdbd0bd7b9e4491119092a0 (patch)
tree8d469a1420dbf643176969d26af7077ead65e80a /lib
parent7e73b255335a73128ece5f495a48533e49a79226 (diff)
downloadnextcloud-server-c6be1ba8d35ceb398fdbd0bd7b9e4491119092a0.tar.gz
nextcloud-server-c6be1ba8d35ceb398fdbd0bd7b9e4491119092a0.zip
fix check if a file is excluded from encryption or not
Diffstat (limited to 'lib')
-rw-r--r--lib/private/encryption/util.php19
-rw-r--r--lib/private/files/storage/wrapper/encryption.php2
2 files changed, 17 insertions, 4 deletions
diff --git a/lib/private/encryption/util.php b/lib/private/encryption/util.php
index 2c6ff266841..85e852ec2c9 100644
--- a/lib/private/encryption/util.php
+++ b/lib/private/encryption/util.php
@@ -389,9 +389,22 @@ class Util {
* @return boolean
*/
public function isExcluded($path) {
- $root = explode('/', $path, 2);
- if (isset($root[0])) {
- if (in_array($root[0], $this->excludedPaths)) {
+ $normalizedPath = \OC\Files\Filesystem::normalizePath($path);
+ $root = explode('/', $normalizedPath, 4);
+ if (count($root) > 2) {
+
+ //detect system wide folders
+ if (in_array($root[1], $this->excludedPaths)) {
+ return true;
+ }
+
+ $v1 = $this->userManager->userExists($root[1]);
+ $v2 = in_array($root[2], $this->excludedPaths);
+
+ // detect user specific folders
+ if ($this->userManager->userExists($root[1])
+ && in_array($root[2], $this->excludedPaths)) {
+
return true;
}
}
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php
index 44fc2124f7a..0e70c99c8d7 100644
--- a/lib/private/files/storage/wrapper/encryption.php
+++ b/lib/private/files/storage/wrapper/encryption.php
@@ -254,7 +254,7 @@ class Encryption extends Wrapper {
'" not found, file will be stored unencrypted');
}
- if($shouldEncrypt === true && !$this->util->isExcluded($path) && $encryptionModule !== null) {
+ if($shouldEncrypt === true && !$this->util->isExcluded($fullPath) && $encryptionModule !== null) {
$source = $this->storage->fopen($path, $mode);
$handle = \OC\Files\Stream\Encryption::wrap($source, $path, $fullPath, $header,
$this->uid, $encryptionModule, $this->storage, $this, $this->util, $mode,