fix(appstore): catch GenericFileException when reading cache file in Fetcher#60286
Open
miaulalala wants to merge 1 commit into
Open
fix(appstore): catch GenericFileException when reading cache file in Fetcher#60286miaulalala wants to merge 1 commit into
miaulalala wants to merge 1 commit into
Conversation
3c382fb to
ee78276
Compare
Contributor
Author
|
/backport to stable33 |
Contributor
Author
|
/backport to stable32 |
provokateurin
requested changes
May 11, 2026
Member
provokateurin
left a comment
There was a problem hiding this comment.
I don't think this makes any sense.
…Fetcher When the appstore cache file exists but file_get_contents returns false (e.g. empty or corrupted file), a GenericFileException is thrown but was not caught, crashing the apps settings page. Recreate the file and proceed to fetch fresh data, same as when the file is absent. Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ee78276 to
01807e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the appstore cache file exists but
file_get_contentsreturnsfalse,OC\Files\Node\File::getContent()throws aGenericFileException. This exception was not caught byFetcher::get(), which only caughtNotFoundException, causing the entire apps settings page to crash with an unhandled exception.Fix: catch
GenericFileExceptionalongsideNotFoundException, log a warning, recreate the cache file, and proceed to fetch fresh data from the appstore — same recovery path as when the file is absent.Test plan
testGetWithUnreadableCacheFileRecreatesAndFetchesinFetcherBasethat mocksgetContent()throwingGenericFileExceptionand asserts the fetcher recovers and returns fresh data🤖 Generated with Claude Code