handle error if we can't handle the given path

This commit is contained in:
Bjoern Schiessle 2013-07-30 15:27:59 +02:00
parent a6ced6b53f
commit a212c98125
2 changed files with 7 additions and 2 deletions

View file

@ -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;
}

View file

@ -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;