diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-07-30 15:27:59 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-07-30 15:27:59 +0200 |
commit | a212c98125c956c35a72e966d72e720b0fd42376 (patch) | |
tree | 4708f48ce08badb1e038e40724da5546a5e321aa /apps/files_encryption | |
parent | a6ced6b53fe7ff32bf126f75bda4fdb23bda19c1 (diff) | |
download | nextcloud-server-a212c98125c956c35a72e966d72e720b0fd42376.tar.gz nextcloud-server-a212c98125c956c35a72e966d72e720b0fd42376.zip |
handle error if we can't handle the given path
Diffstat (limited to 'apps/files_encryption')
-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; |