diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-02-13 13:30:54 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-02-13 13:30:54 +0100 |
commit | 276bfe5f332fcd494427d161df1472d07e93c713 (patch) | |
tree | 667ff0487dc6ab407cb060b79235086b6bffeec0 | |
parent | 95860d81130e0dead6a0156fb00f89dee0184993 (diff) | |
parent | 9904b300700d916af5c0aa9c36fed7e5e589d12d (diff) | |
download | nextcloud-server-276bfe5f332fcd494427d161df1472d07e93c713.tar.gz nextcloud-server-276bfe5f332fcd494427d161df1472d07e93c713.zip |
Merge pull request #14197 from owncloud/ensure-that-passed-file-path-is-always-a-string
Ensure that passed argument is always a string
-rw-r--r-- | apps/files/ajax/list.php | 2 | ||||
-rw-r--r-- | lib/private/files/filesystem.php | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php index 4aed79d70f7..b590776830a 100644 --- a/apps/files/ajax/list.php +++ b/apps/files/ajax/list.php @@ -5,7 +5,7 @@ OCP\JSON::checkLoggedIn(); $l = \OC::$server->getL10N('files'); // Load the files -$dir = isset($_GET['dir']) ? $_GET['dir'] : ''; +$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : ''; $dir = \OC\Files\Filesystem::normalizePath($dir); try { diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index e933782ce2f..04f82d88cd1 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -723,9 +723,18 @@ class Filesystem { * Fix common problems with a file path * @param string $path * @param bool $stripTrailingSlash + * @param bool $isAbsolutePath * @return string */ public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false) { + /** + * FIXME: This is a workaround for existing classes and files which call + * this function with another type than a valid string. This + * conversion should get removed as soon as all existing + * function calls have been fixed. + */ + $path = (string)$path; + $cacheKey = json_encode([$path, $stripTrailingSlash, $isAbsolutePath]); if(isset(self::$normalizedPathCache[$cacheKey])) { |