From b7c677cffe3c9ac5d14ea3b4944a9a9ac414e3b2 Mon Sep 17 00:00:00 2001 From: Oleksander Piskun Date: Fri, 5 Jun 2026 12:46:12 +0000 Subject: [PATCH] fix(fetcher): catch GenericFileException when reading the appstore cache file Signed-off-by: Oleksander Piskun --- lib/Fetcher/AppAPIFetcher.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Fetcher/AppAPIFetcher.php b/lib/Fetcher/AppAPIFetcher.php index cce3de3c..f7cfa75c 100644 --- a/lib/Fetcher/AppAPIFetcher.php +++ b/lib/Fetcher/AppAPIFetcher.php @@ -15,6 +15,7 @@ use OCA\AppAPI\AppInfo\Application; use OCP\AppFramework\Http; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\Files\GenericFileException; use OCP\Files\IAppData; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; @@ -148,6 +149,16 @@ public function get(bool $allowUnstable = false): array { } catch (NotFoundException $e) { // File does not already exists $file = $rootFolder->newFile($this->fileName); + } catch (GenericFileException $e) { + // File exists but is unreadable (I/O or OS-level permission failure); drop it and refresh + try { + $file->delete(); + } catch (Exception) { + $this->logger->error('Could not read appstore cache file', ['app' => 'appstoreExAppFetcher', 'exception' => $e]); + return []; + } + $this->logger->warning('Could not read appstore cache file, it will be refreshed', ['app' => 'appstoreExAppFetcher', 'exception' => $e]); + $file = $rootFolder->newFile($this->fileName); } // Refresh the file content