@@ -128,13 +128,26 @@ protected function getSystemTags() {
128128 * @return int[]
129129 */
130130 protected function getFileIds (ICache $ cache , $ path , $ isExternalStorage ) {
131- // TODO: Fix caching inside group folders
132- // Do not cache file ids inside group folders because multiple file ids might be mapped to
133- // the same combination of cache id + path.
134- $ shouldCacheFileIds = !$ this ->storage
135- ->instanceOfStorage (\OCA \GroupFolders \Mount \GroupFolderStorage::class);
136- $ cacheId = $ cache ->getNumericStorageId ();
137- if ($ shouldCacheFileIds && isset ($ this ->fileIds [$ cacheId ][$ path ])) {
131+ if ($ this ->storage ->instanceOfStorage (\OCA \GroupFolders \Mount \GroupFolderStorage::class)) {
132+ // Special implementation for groupfolder since all groupfolders share the same storage
133+ // id so add the group folder id in the cache key too.
134+ $ groupFolderStorage = $ this ->storage ;
135+ if ($ this ->storage instanceof Wrapper) {
136+ $ groupFolderStorage = $ this ->storage ->getInstanceOfStorage (\OCA \GroupFolders \Mount \GroupFolderStorage::class);
137+ }
138+ if ($ groupFolderStorage === null ) {
139+ throw new \LogicException ('Should not happen: Storage is instance of GroupFolderStorage but no group folder storage found while unwrapping. ' );
140+ }
141+ /**
142+ * @psalm-suppress UndefinedDocblockClass
143+ * @psalm-suppress UndefinedInterfaceMethod
144+ */
145+ $ cacheId = $ cache ->getNumericStorageId () . '/ ' . $ groupFolderStorage ->getFolderId ();
146+ This conversation was marked as resolved by CarlSchwan
147+ } else {
148+ $ cacheId = $ cache ->getNumericStorageId ();
149+ }
150+ if (isset ($ this ->fileIds [$ cacheId ][$ path ])) {
138151 return $ this ->fileIds [$ cacheId ][$ path ];
139152 }
140153
0 commit comments