diff options
-rwxr-xr-x | apps/files_encryption/lib/helper.php | 4 | ||||
-rw-r--r-- | apps/files_encryption/lib/stream.php | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index f5a5d269a69..a9a78026d96 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -201,7 +201,7 @@ class Helper { $split = explode('/', $trimmed); // it is not a file relative to data/user/files - if ($split[1] !== 'files') { + if (count($split) < 3 || $split[1] !== 'files') { return false; } @@ -220,7 +220,7 @@ class Helper { $trimmed = ltrim($path, '/'); $split = explode('/', $trimmed); - if ($split[1] !== "files_versions") { + if (count($split) < 3 || $split[1] !== "files_versions") { return false; } diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php index d9146e75b63..335ea3733eb 100644 --- a/apps/files_encryption/lib/stream.php +++ b/apps/files_encryption/lib/stream.php @@ -107,6 +107,11 @@ class Stream { $this->relPath = Helper::getPathToRealFile($this->rawPath); } + if($this->relPath === false) { + \OCP\Util::writeLog('Encryption library', 'failed to open file "' . $this->rawPath . '" expecting a path to user/files or to user/files_versions', \OCP\Util::ERROR); + return false; + } + // Disable fileproxies so we can get the file size and open the source file without recursive encryption $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; |