Skip to content

Commit 738c153

Browse files
committed
fix(workflows): Fix file systemtag cache
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent cd7007c commit 738c153

1 file changed

Lines changed: 10 additions & 20 deletions

File tree

apps/workflowengine/lib/Check/FileSystemTags.php

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace OCA\WorkflowEngine\Check;
77

8-
use OC\Files\Storage\Wrapper\Wrapper;
8+
use OC\Files\Storage\Wrapper\Jail;
99
use OCA\Files_Sharing\SharedStorage;
1010
use OCA\WorkflowEngine\Entity\File;
1111
use OCP\Files\Cache\ICache;
@@ -133,27 +133,17 @@ protected function getSystemTags() {
133133
* @return int[]
134134
*/
135135
protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
136-
/** @psalm-suppress InvalidArgument */
137-
if ($this->storage->instanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class)) {
138-
// Special implementation for groupfolder since all groupfolders share the same storage
139-
// id so add the group folder id in the cache key too.
140-
$groupFolderStorage = $this->storage;
141-
if ($this->storage instanceof Wrapper) {
142-
$groupFolderStorage = $this->storage->getInstanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class);
143-
}
144-
if ($groupFolderStorage === null) {
145-
throw new \LogicException('Should not happen: Storage is instance of GroupFolderStorage but no group folder storage found while unwrapping.');
146-
}
147-
/**
148-
* @psalm-suppress UndefinedDocblockClass
149-
* @psalm-suppress UndefinedInterfaceMethod
150-
*/
151-
$cacheId = $cache->getNumericStorageId() . '/' . $groupFolderStorage->getFolderId();
136+
if ($this->storage->instanceOfStorage(Jail::class)) {
137+
$absolutePath = $this->storage->getUnjailedPath($path);
138+
$cacheId = $cache->getNumericStorageId();
139+
} elseif ($this->storage->instanceOfStorage(Jail::class)) {
140+
$cacheId = $cache->getNumericStorageId() . '/' . $this->storage->getUnjailedPath('');
152141
} else {
142+
$absolutePath = $path;
153143
$cacheId = $cache->getNumericStorageId();
154144
}
155-
if (isset($this->fileIds[$cacheId][$path])) {
156-
return $this->fileIds[$cacheId][$path];
145+
if (isset($this->fileIds[$cacheId][$absolutePath])) {
146+
return $this->fileIds[$cacheId][$absolutePath];
157147
}
158148

159149
$parentIds = [];
@@ -168,7 +158,7 @@ protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
168158
$parentIds[] = $fileId;
169159
}
170160

171-
$this->fileIds[$cacheId][$path] = $parentIds;
161+
$this->fileIds[$cacheId][$absolutePath] = $parentIds;
172162

173163
return $parentIds;
174164
}

0 commit comments

Comments
 (0)