From 6fb747d7c7dab96a0df0276a74df6baec76e421a Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Wed, 18 Mar 2026 14:29:08 +0100 Subject: [PATCH 1/2] fix: Log exceptions during fetching templates Signed-off-by: Julius Knorr --- lib/Controller/SettingsController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 35f1472ba0..fe02408eaa 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -512,8 +512,10 @@ public function getSettingsFile(string $type, string $token, string $category, s ] ); } catch (NotFoundException $e) { + $this->logger->info('Settings file not found', ['type' => $type, 'category' => $category, 'name' => $name, 'exception' => $e]); return new DataDisplayResponse('File not found.', 404); } catch (\Exception $e) { + $this->logger->error('Error fetching settings file', ['exception' => $e]); return new DataDisplayResponse('Something went wrong', 500); } } From 0bda8231c7b5bf554b9c4b955b9295b2d7f4081e Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Fri, 20 Mar 2026 12:19:18 +0100 Subject: [PATCH 2/2] debug: Add more debugging for storage and cache wrappers Signed-off-by: Julius Knorr --- lib/TemplateManager.php | 79 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/lib/TemplateManager.php b/lib/TemplateManager.php index 1c6e52beec..56e27066b5 100644 --- a/lib/TemplateManager.php +++ b/lib/TemplateManager.php @@ -107,6 +107,51 @@ public function setUserId(?string $userId): void { $this->userId = $userId; } + private function debugStorage($file) { + $storage = $file->getStorage(); + + while ($storage) { + $class = get_class($storage); + $this->logger->warning( + 'DEBUG: storage unwrap {fullPath} ({internalPath}) {className} with permissions {permissions}, double-check is it readable: {isReadable}', + [ + 'app' => Application::APPNAME, + 'fullPath' => $file->getPath(), + 'internalPath' => $file->getInternalPath(), + 'permissions' => $storage->getPermissions($file->getInternalPath()), + 'isReadable' => $storage->isReadable($file->getInternalPath()), + 'className' => $class, + ] + ); + if ($storage instanceof \OC\Files\Storage\Wrapper\Wrapper) { + $storage = $storage->getWrapperStorage(); + } else { + $storage = null; + } + } + + $cache = $file->getStorage()->getCache(); + + while ($cache) { + $class = get_class($cache); + $this->logger->warning( + 'DEBUG: cache unwrap {fullPath} ({internalPath}) {className} with permissions {permissions}', + [ + 'app' => Application::APPNAME, + 'fullPath' => $file->getPath(), + 'internalPath' => $file->getInternalPath(), + 'permissions' => $cache->get($file->getInternalPath())->getPermissions(), + 'className' => $class, + ] + ); + if ($cache instanceof \OC\Files\Cache\Wrapper\CacheWrapper) { + $cache = $cache->getCache(); + } else { + $cache = null; + } + } + } + /** * Get template ISimpleFile|Node * @@ -119,6 +164,18 @@ public function get(int $fileId) { foreach ($files as $file) { if ($file->getId() === $fileId) { + $this->logger->warning( + 'DEBUG: found template in empty_templates dir: {fullPath} ({internalPath}) with permissions {permissions}, double-check is it readable: {isReadable}', + [ + 'app' => Application::APPNAME, + 'fullPath' => $file->getPath(), + 'internalPath' => $file->getInternalPath(), + 'permissions' => $file->getPermissions(), + 'isReadable' => $file->isReadable(), + ] + ); + $this->debugStorage($file); + return $file; } } @@ -132,6 +189,17 @@ public function get(int $fileId) { foreach ($files as $file) { if ($file->getId() === $fileId) { + $this->logger->warning( + 'DEBUG: found template in system templates dir: {fullPath} ({internalPath}) with permissions {permissions}, double-check is it readable: {isReadable}', + [ + 'app' => Application::APPNAME, + 'fullPath' => $file->getPath(), + 'internalPath' => $file->getInternalPath(), + 'permissions' => $file->getPermissions(), + 'isReadable' => $file->isReadable(), + ] + ); + $this->debugStorage($file); return $file; } } @@ -140,6 +208,17 @@ public function get(int $fileId) { // finally get the template file $file = $templateDir->getFirstNodeById($fileId); if ($file !== null) { + $this->logger->warning( + 'DEBUG: found template in user templates dir: {fullPath} ({internalPath}) with permissions {permissions}, double-check is it readable: {isReadable}', + [ + 'app' => Application::APPNAME, + 'fullPath' => $file->getPath(), + 'internalPath' => $file->getInternalPath(), + 'permissions' => $file->getPermissions(), + 'isReadable' => $file->isReadable(), + ] + ); + $this->debugStorage($file); return $file; }