Skip to content

Commit aa0536b

Browse files
Merge pull request #46409 from nextcloud/backport/46388/stable26
[stable26] fix(workflows): Fix file systemtag cache
2 parents 43fa5b6 + fabea78 commit aa0536b

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

apps/workflowengine/lib/Check/FileSystemTags.php

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727
namespace OCA\WorkflowEngine\Check;
2828

29+
use OC\Files\Storage\Wrapper\Jail;
2930
use OCA\Files_Sharing\SharedStorage;
3031
use OCA\WorkflowEngine\Entity\File;
3132
use OCP\Files\Cache\ICache;
@@ -39,7 +40,6 @@
3940
use OCP\SystemTag\TagNotFoundException;
4041
use OCP\WorkflowEngine\ICheck;
4142
use OCP\WorkflowEngine\IFileCheck;
42-
use OC\Files\Storage\Wrapper\Wrapper;
4343

4444
class FileSystemTags implements ICheck, IFileCheck {
4545
use TFileCheck;
@@ -154,27 +154,15 @@ protected function getSystemTags() {
154154
* @return int[]
155155
*/
156156
protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
157-
/** @psalm-suppress InvalidArgument */
158-
if ($this->storage->instanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class)) {
159-
// Special implementation for groupfolder since all groupfolders share the same storage
160-
// id so add the group folder id in the cache key too.
161-
$groupFolderStorage = $this->storage;
162-
if ($this->storage instanceof Wrapper) {
163-
$groupFolderStorage = $this->storage->getInstanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class);
164-
}
165-
if ($groupFolderStorage === null) {
166-
throw new \LogicException('Should not happen: Storage is instance of GroupFolderStorage but no group folder storage found while unwrapping.');
167-
}
168-
/**
169-
* @psalm-suppress UndefinedDocblockClass
170-
* @psalm-suppress UndefinedInterfaceMethod
171-
*/
172-
$cacheId = $cache->getNumericStorageId() . '/' . $groupFolderStorage->getFolderId();
157+
$cacheId = $cache->getNumericStorageId();
158+
if ($this->storage->instanceOfStorage(Jail::class)) {
159+
$absolutePath = $this->storage->getUnjailedPath($path);
173160
} else {
174-
$cacheId = $cache->getNumericStorageId();
161+
$absolutePath = $path;
175162
}
176-
if (isset($this->fileIds[$cacheId][$path])) {
177-
return $this->fileIds[$cacheId][$path];
163+
164+
if (isset($this->fileIds[$cacheId][$absolutePath])) {
165+
return $this->fileIds[$cacheId][$absolutePath];
178166
}
179167

180168
$parentIds = [];
@@ -189,7 +177,7 @@ protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
189177
$parentIds[] = $fileId;
190178
}
191179

192-
$this->fileIds[$cacheId][$path] = $parentIds;
180+
$this->fileIds[$cacheId][$absolutePath] = $parentIds;
193181

194182
return $parentIds;
195183
}

0 commit comments

Comments
 (0)