Skip to content

Commit af1112d

Browse files
juliusknorrbackportbot[bot]
authored andcommitted
fix: Proper order for checking path prefix for getting file by id from cache
Signed-off-by: Julius Knorr <jus@bitgrid.net>
1 parent c6dd578 commit af1112d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/private/Files/Node/Root.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ 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
394394
$node = $this->get($cachedPath);
395395
// by validating that the cached path still has the requested fileid we can work around the need to invalidate the cached path

0 commit comments

Comments
 (0)