From 61da3d530d489525fc0a6dd9575dc9ab37f1bc44 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 9 Dec 2015 07:32:19 +0100 Subject: [PATCH] Verify return type Can also be null. Silences another security warning... --- lib/private/files/view.php | 2 +- lib/private/preview.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 6abefff4198..b8b1b8a50d6 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -1253,7 +1253,7 @@ class View { * @param boolean|string $includeMountPoints true to add mountpoint sizes, * 'ext' to add only ext storage mount point sizes. Defaults to true. * defaults to true - * @return \OC\Files\FileInfo|bool False if file does not exist + * @return \OC\Files\FileInfo|false False if file does not exist */ public function getFileInfo($path, $includeMountPoints = true) { $this->assertPathLength($path); diff --git a/lib/private/preview.php b/lib/private/preview.php index b2accdfd00f..38c043030fc 100644 --- a/lib/private/preview.php +++ b/lib/private/preview.php @@ -1250,7 +1250,7 @@ class Preview { * @param array $args * @param string $prefix */ - public static function prepare_delete($args, $prefix = '') { + public static function prepare_delete(array $args, $prefix = '') { $path = $args['path']; if (substr($path, 0, 1) === '/') { $path = substr($path, 1); @@ -1259,7 +1259,11 @@ class Preview { $view = new \OC\Files\View('/' . \OC_User::getUser() . '/' . $prefix); $absPath = Files\Filesystem::normalizePath($view->getAbsolutePath($path)); - self::addPathToDeleteFileMapper($absPath, $view->getFileInfo($path)); + $fileInfo = $view->getFileInfo($path); + if($fileInfo === false) { + return; + } + self::addPathToDeleteFileMapper($absPath, $fileInfo); if ($view->is_dir($path)) { $children = self::getAllChildren($view, $path); self::$deleteChildrenMapper[$absPath] = $children; -- 2.39.5