fix(SimpleFile): Catch exception and call checkFile() to sanitize broken appdata folder#59981
Open
DerDreschner wants to merge 1 commit intomasterfrom
Open
fix(SimpleFile): Catch exception and call checkFile() to sanitize broken appdata folder#59981DerDreschner wants to merge 1 commit intomasterfrom
checkFile() to sanitize broken appdata folder#59981DerDreschner wants to merge 1 commit intomasterfrom
Conversation
Contributor
Author
|
/backport to stable33 |
Contributor
Author
|
/backport to stable32 |
1d3741e to
dd62131
Compare
8 tasks
Contributor
Author
Please have a look into the CI pipeline and the failed psalm run. That uncovers the surface of the mess. 😓 Help anyone? |
…ken appdata structure Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
dd62131 to
155034c
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
During analyzing of #56510, I realized that broken
appdatafolders are not handled correctly since version 27 (this commit to be precise).The issue here is that folders and their files can be listed in the
oc_filecachedatabase table, but not exist on filesystem anymore. If that is the case, our wrappers still work correctly as they always prefer the file cache... Until it comes to really read or write to the file system. And here our ownputContent()andgetContent()methods don't follow the same scheme as theirput_file_contents()andget_file_contents()counterparts as we throw an exception instead of returningfalse.This change isn't considered on all calls... I can only speak for the preview generation, as that's what I try to fix. The introduction of the
oc_previewstable fixed the issue there, which means only Nextcloud 32 and older are affected by this bug. But a quick look through the code tells me that there are still a lot more cases that expectfalsein case of an error, while others already catch anNotFoundException(that's only being thrown when there's no hit against the file cache or method calls likecheckPermission()fail... Ohh lord...).Anyway... With this change, the preview generation will restore the correct
appdatastructure and starts to generate previews instead of being broken until someone runsocc preview:cleanupmanually.Checklist
3. to review, feature component)stable32)AI (if applicable)