diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2024-07-10 16:46:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-10 16:46:14 +0200 |
commit | 78bb1dc55cca5759e9c9ef12cc499ed84a02a695 (patch) | |
tree | 43e9d63dd0bff7a55b8366baf06082295a5f9352 | |
parent | b50182b0d6be7c04f2b57efbfb12b5a226de8baf (diff) | |
parent | a2a0a5afcb29bfbbdacf353219f7081f4a7dc8ea (diff) | |
download | nextcloud-server-78bb1dc55cca5759e9c9ef12cc499ed84a02a695.tar.gz nextcloud-server-78bb1dc55cca5759e9c9ef12cc499ed84a02a695.zip |
Merge pull request #46388 from nextcloud/bugfix/noid/broken-file-systemtag-cache
fix(workflows): Fix file systemtag cache
-rw-r--r-- | apps/workflowengine/lib/Check/FileSystemTags.php | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/apps/workflowengine/lib/Check/FileSystemTags.php b/apps/workflowengine/lib/Check/FileSystemTags.php index af1f1930ef0..ca81eb828dc 100644 --- a/apps/workflowengine/lib/Check/FileSystemTags.php +++ b/apps/workflowengine/lib/Check/FileSystemTags.php @@ -5,7 +5,7 @@ */ namespace OCA\WorkflowEngine\Check; -use OC\Files\Storage\Wrapper\Wrapper; +use OC\Files\Storage\Wrapper\Jail; use OCA\Files_Sharing\SharedStorage; use OCA\WorkflowEngine\Entity\File; use OCP\Files\Cache\ICache; @@ -133,27 +133,15 @@ class FileSystemTags implements ICheck, IFileCheck { * @return int[] */ protected function getFileIds(ICache $cache, $path, $isExternalStorage) { - /** @psalm-suppress InvalidArgument */ - if ($this->storage->instanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class)) { - // Special implementation for groupfolder since all groupfolders share the same storage - // id so add the group folder id in the cache key too. - $groupFolderStorage = $this->storage; - if ($this->storage instanceof Wrapper) { - $groupFolderStorage = $this->storage->getInstanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class); - } - if ($groupFolderStorage === null) { - throw new \LogicException('Should not happen: Storage is instance of GroupFolderStorage but no group folder storage found while unwrapping.'); - } - /** - * @psalm-suppress UndefinedDocblockClass - * @psalm-suppress UndefinedInterfaceMethod - */ - $cacheId = $cache->getNumericStorageId() . '/' . $groupFolderStorage->getFolderId(); + $cacheId = $cache->getNumericStorageId(); + if ($this->storage->instanceOfStorage(Jail::class)) { + $absolutePath = $this->storage->getUnjailedPath($path); } else { - $cacheId = $cache->getNumericStorageId(); + $absolutePath = $path; } - if (isset($this->fileIds[$cacheId][$path])) { - return $this->fileIds[$cacheId][$path]; + + if (isset($this->fileIds[$cacheId][$absolutePath])) { + return $this->fileIds[$cacheId][$absolutePath]; } $parentIds = []; @@ -168,7 +156,7 @@ class FileSystemTags implements ICheck, IFileCheck { $parentIds[] = $fileId; } - $this->fileIds[$cacheId][$path] = $parentIds; + $this->fileIds[$cacheId][$absolutePath] = $parentIds; return $parentIds; } |