From 68091bbce34abec88cdd6927a44ebdf5f3cd7124 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 7 Nov 2025 17:25:29 +0100 Subject: [PATCH 1/2] debug: throw a proper error when directory content has a null path Signed-off-by: Robin Appelman --- lib/private/Files/View.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index ecf2f438edb1f..c4d4b8077b614 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1527,6 +1527,9 @@ public function getDirectoryContent($directory, $mimetype_filter = '', ?\OCP\Fil if ($sharingDisabled) { $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; } + if (is_null($content['path'])) { + throw new \Exception('Directory listing of "' . $path . '" contains item with null path'); + } $ownerId = $storage->getOwner($content['path']); if ($ownerId !== false) { $owner = $this->getUserObjectForOwner($ownerId); From 6a2f593a56ddab0387b7986568810f14d077f193 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 24 Nov 2025 17:06:19 +0100 Subject: [PATCH 2/2] debug: add more logging around null paths with jails Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Wrapper/CacheJail.php | 6 +++++- lib/private/Files/Cache/Wrapper/CacheWrapper.php | 2 ++ lib/private/Files/View.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index 7fc5c8e3191ad..5366c0923778b 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -92,7 +92,11 @@ protected function getJailedPath(string $path, ?string $root = null) { protected function formatCacheEntry($entry) { if (isset($entry['path'])) { - $entry['path'] = $this->getJailedPath($entry['path']); + $sourcePath = $entry['path']; + $entry['path'] = $this->getJailedPath($sourcePath); + if (is_null($entry['path'])) { + $this->logger->error("'$sourcePath' is not inside jail path {$this->root}", ['entry' => $entry]); + } } return $entry; } diff --git a/lib/private/Files/Cache/Wrapper/CacheWrapper.php b/lib/private/Files/Cache/Wrapper/CacheWrapper.php index bf23f1cc30ab0..8149ea19419f0 100644 --- a/lib/private/Files/Cache/Wrapper/CacheWrapper.php +++ b/lib/private/Files/Cache/Wrapper/CacheWrapper.php @@ -27,6 +27,7 @@ public function __construct(?ICache $cache, ?CacheDependencies $dependencies = n $this->mimetypeLoader = $cache->mimetypeLoader; $this->connection = $cache->connection; $this->querySearchHelper = $cache->querySearchHelper; + $this->logger = $cache->logger; } else { if (!$dependencies) { $dependencies = Server::get(CacheDependencies::class); @@ -34,6 +35,7 @@ public function __construct(?ICache $cache, ?CacheDependencies $dependencies = n $this->mimetypeLoader = $dependencies->getMimeTypeLoader(); $this->connection = $dependencies->getConnection(); $this->querySearchHelper = $dependencies->getQuerySearchHelper(); + $this->logger = $dependencies->getLogger(); } } diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index c4d4b8077b614..5987188067153 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1528,7 +1528,7 @@ public function getDirectoryContent($directory, $mimetype_filter = '', ?\OCP\Fil $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; } if (is_null($content['path'])) { - throw new \Exception('Directory listing of "' . $path . '" contains item with null path'); + throw new \Exception('Directory listing of "' . $path . '" contains item with null path (' . $content['fileid'] . ')'); } $ownerId = $storage->getOwner($content['path']); if ($ownerId !== false) {