]> source.dussan.org Git - nextcloud-server.git/commitdiff
dont use `false` as cache key for non utf8 path in normalizePath 22520/head
authorRobin Appelman <robin@icewind.nl>
Mon, 31 Aug 2020 15:29:36 +0000 (17:29 +0200)
committerRobin Appelman <robin@icewind.nl>
Mon, 31 Aug 2020 15:29:36 +0000 (17:29 +0200)
since `json_encode` returns `false` if it's input isn't utf8, all non utf8 paths passed to normalizePath will currently return the same cached result.

Fixing this makes working with non utf8 storages a *little* bit more possible for apps

Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/Filesystem.php

index b85554ae333a311ac3d1cbf093b05545895312ad..3ad518b3950b6b996a15d4e8fd7973ccbf3d530c 100644 (file)
@@ -813,7 +813,7 @@ class Filesystem {
 
                $cacheKey = json_encode([$path, $stripTrailingSlash, $isAbsolutePath, $keepUnicode]);
 
-               if (isset(self::$normalizedPathCache[$cacheKey])) {
+               if ($cacheKey && isset(self::$normalizedPathCache[$cacheKey])) {
                        return self::$normalizedPathCache[$cacheKey];
                }