aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Knorr <jus@bitgrid.net>2025-04-08 09:17:35 +0200
committerJulius Knorr <jus@bitgrid.net>2025-04-08 20:08:50 +0200
commite5209d4076aa06d48ba129281cacc783b772498d (patch)
tree2f51bc936866b903d660b006df9137dc9b91612d
parent49f22285708ed28bd443ff39fd1ec0060134157d (diff)
downloadnextcloud-server-backport/52008/stable31.tar.gz
nextcloud-server-backport/52008/stable31.zip
fix: Catch old cached paths and fetch the new onebackport/52008/stable31
Signed-off-by: Julius Knorr <jus@bitgrid.net>
-rw-r--r--lib/private/Files/Node/Root.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index cf837cba397..88aa46ce336 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -386,11 +386,15 @@ class Root extends Folder implements IRootFolder {
$cachedPath = $this->pathByIdCache->get($this->user->getUID() . '::' . $id);
if ($cachedPath && str_starts_with($cachedPath, $path)) {
// getting the node by path is significantly cheaper than finding it by id
- $node = $this->get($cachedPath);
- // by validating that the cached path still has the requested fileid we can work around the need to invalidate the cached path
- // if the cached path is invalid or a different file now we fall back to the uncached logic
- if ($node && $node->getId() === $id) {
- return $node;
+ try {
+ $node = $this->get($cachedPath);
+ // by validating that the cached path still has the requested fileid we can work around the need to invalidate the cached path
+ // if the cached path is invalid or a different file now we fall back to the uncached logic
+ if ($node && $node->getId() === $id) {
+ return $node;
+ }
+ } catch (NotFoundException|NotPermittedException) {
+ // The file may be moved but the old path still in cache
}
}
}