File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -389,13 +389,17 @@ public function getFirstNodeByIdInPath(int $id, string $path): ?INode {
389389 // scope the cache by user, so we don't return nodes for different users
390390 if ($ this ->user ) {
391391 $ cachedPath = $ this ->pathByIdCache ->get ($ this ->user ->getUID () . ':: ' . $ id );
392- if ($ cachedPath && str_starts_with ($ path , $ cachedPath )) {
392+ if ($ cachedPath && str_starts_with ($ cachedPath , $ path )) {
393393 // getting the node by path is significantly cheaper than finding it by id
394- $ node = $ this ->get ($ cachedPath );
395- // by validating that the cached path still has the requested fileid we can work around the need to invalidate the cached path
396- // if the cached path is invalid or a different file now we fall back to the uncached logic
397- if ($ node && $ node ->getId () === $ id ) {
398- return $ node ;
394+ try {
395+ $ node = $ this ->get ($ cachedPath );
396+ // by validating that the cached path still has the requested fileid we can work around the need to invalidate the cached path
397+ // if the cached path is invalid or a different file now we fall back to the uncached logic
398+ if ($ node && $ node ->getId () === $ id ) {
399+ return $ node ;
400+ }
401+ } catch (NotFoundException |NotPermittedException ) {
402+ // The file may be moved but the old path still in cache
399403 }
400404 }
401405 }
You can’t perform that action at this time.
0 commit comments