From 80dd8d7802f90ce088b03e46d62e12367dcad278 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 3 Feb 2013 23:34:27 +0100 Subject: [PATCH 1/2] Cache: check for invalid paths in getFileInfo/getDirectoryContent --- lib/files/view.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/files/view.php b/lib/files/view.php index 302232b513..ff94d3e602 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -670,6 +670,9 @@ class View { */ public function getFileInfo($path) { $data = array(); + if (!Filesystem::isValidPath($path)) { + return $data; + } $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); /** * @var \OC\Files\Storage\Storage $storage @@ -724,6 +727,9 @@ class View { */ public function getDirectoryContent($directory, $mimetype_filter = '') { $result = array(); + if (!Filesystem::isValidPath($path)) { + return $data; + } $path = Filesystem::normalizePath($this->fakeRoot . '/' . $directory); /** * @var \OC\Files\Storage\Storage $storage From 7c33d0a5a763be92c7e6dbf526484ef372c7111f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 4 Feb 2013 13:28:31 +0100 Subject: [PATCH 2/2] Cache: fix copy-paste errors --- lib/files/view.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/files/view.php b/lib/files/view.php index ff94d3e602..00c0c3b115 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -727,8 +727,8 @@ class View { */ public function getDirectoryContent($directory, $mimetype_filter = '') { $result = array(); - if (!Filesystem::isValidPath($path)) { - return $data; + if (!Filesystem::isValidPath($directory)) { + return $result; } $path = Filesystem::normalizePath($this->fakeRoot . '/' . $directory); /**