]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: verify that parent exists in cache when inserting
authorRobin Appelman <robin@icewind.nl>
Wed, 18 Sep 2024 10:29:13 +0000 (12:29 +0200)
committerRobin Appelman <robin@icewind.nl>
Thu, 19 Sep 2024 15:44:45 +0000 (17:44 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/Cache/Cache.php

index 7f52935489d86628db7d44622cf9128d0523fd8c..0386aaa06dfc698893729442858a1d1ad0a33852 100644 (file)
@@ -298,6 +298,9 @@ class Cache implements ICache {
                if (!isset($data['parent'])) {
                        $data['parent'] = $this->getParentId($file);
                }
+               if ($data['parent'] === -1 && $file !== '') {
+                       throw new \Exception('Parent folder not in filecache for ' . $file);
+               }
                $data['name'] = basename($file);
 
                [$values, $extensionValues] = $this->normalizeData($data);