diff options
Diffstat (limited to 'lib/private/Files/Filesystem.php')
-rw-r--r-- | lib/private/Files/Filesystem.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index 0b7e96bbba3..131c0780dce 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -777,10 +777,6 @@ class Filesystem { * @return string */ public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false, $keepUnicode = false) { - if (is_null(self::$normalizedPathCache)) { - self::$normalizedPathCache = new CappedMemoryCache(2048); - } - /** * FIXME: This is a workaround for existing classes and files which call * this function with another type than a valid string. This @@ -789,16 +785,20 @@ class Filesystem { */ $path = (string)$path; + if ($path === '') { + return '/'; + } + + if (is_null(self::$normalizedPathCache)) { + self::$normalizedPathCache = new CappedMemoryCache(2048); + } + $cacheKey = json_encode([$path, $stripTrailingSlash, $isAbsolutePath, $keepUnicode]); if ($cacheKey && isset(self::$normalizedPathCache[$cacheKey])) { return self::$normalizedPathCache[$cacheKey]; } - if ($path === '') { - return '/'; - } - //normalize unicode if possible if (!$keepUnicode) { $path = \OC_Util::normalizeUnicode($path); |