@@ -83,7 +83,7 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin {
8383
8484 /** @var array<int, int[]> */
8585 private array $ cachedTagMappings = [];
86- /** @var array<int , ISystemTag> */
86+ /** @var array<string , ISystemTag> */
8787 private array $ cachedTags = [];
8888
8989 private ISystemTagObjectMapper $ tagMapper ;
@@ -225,6 +225,8 @@ private function createTag($data, $contentType = 'application/json') {
225225 *
226226 * @param PropFind $propFind
227227 * @param \Sabre\DAV\INode $node
228+ *
229+ * @return void
228230 */
229231 public function handleGetProperties (
230232 PropFind $ propFind ,
@@ -281,9 +283,9 @@ private function propfindForFile(PropFind $propFind, Node $node): void {
281283 && !is_null ($ propFind ->getStatus (self ::SYSTEM_TAGS_PROPERTYNAME ))) {
282284 // note: pre-fetching only supported for depth <= 1
283285 $ folderContent = $ node ->getNode ()->getDirectoryListing ();
284- $ fileIds [] = ( int ) $ node ->getId ();
286+ $ fileIds [] = $ node ->getId ();
285287 foreach ($ folderContent as $ info ) {
286- $ fileIds [] = ( int ) $ info ->getId ();
288+ $ fileIds [] = $ info ->getId ();
287289 }
288290 $ tags = $ this ->tagMapper ->getTagIdsForObjects ($ fileIds , 'files ' );
289291
@@ -318,20 +320,23 @@ private function getTagsForFile(int $fileId): array {
318320 $ tagIds = [];
319321 }
320322 }
323+
321324 $ tags = array_filter (array_map (function ($ tagId ) {
322325 return $ this ->cachedTags [$ tagId ] ?? null ;
323326 }, $ tagIds ));
324327
325328 $ uncachedTagIds = array_filter ($ tagIds , function ($ tagId ): bool {
326329 return !isset ($ this ->cachedTags [$ tagId ]);
327330 });
331+
328332 if (count ($ uncachedTagIds )) {
329333 $ retrievedTags = $ this ->tagManager ->getTagsByIds ($ uncachedTagIds );
330334 foreach ($ retrievedTags as $ tag ) {
331335 $ this ->cachedTags [$ tag ->getId ()] = $ tag ;
332336 }
333337 $ tags += $ retrievedTags ;
334338 }
339+
335340 return array_filter ($ tags , function (ISystemTag $ tag ) use ($ user ) {
336341 return $ this ->tagManager ->canUserSeeTag ($ tag , $ user );
337342 });
0 commit comments