2727use OC \DB \QueryBuilder \Literal ;
2828use OCA \Files_Sharing \SharedMount ;
2929use OCP \DB \QueryBuilder \IQueryBuilder ;
30+ use OCP \Files \Config \ICachedMountFileInfo ;
3031use OCP \Files \Config \ICachedMountInfo ;
3132use OCP \Files \Config \IUserMountCache ;
3233use OCP \Files \Mount \IMountPoint ;
@@ -282,7 +283,7 @@ private function getCacheInfoFromFileId($fileId) {
282283 /**
283284 * @param int $fileId
284285 * @param string|null $user optionally restrict the results to a single user
285- * @return ICachedMountInfo []
286+ * @return ICachedMountFileInfo []
286287 * @since 9.0.0
287288 */
288289 public function getMountsForFileId ($ fileId , $ user = null ) {
@@ -294,14 +295,26 @@ public function getMountsForFileId($fileId, $user = null) {
294295 $ mountsForStorage = $ this ->getMountsForStorageId ($ storageId , $ user );
295296
296297 // filter mounts that are from the same storage but a different directory
297- return array_filter ($ mountsForStorage , function (ICachedMountInfo $ mount ) use ($ internalPath , $ fileId ) {
298+ $ filteredMounts = array_filter ($ mountsForStorage , function (ICachedMountInfo $ mount ) use ($ internalPath , $ fileId ) {
298299 if ($ fileId === $ mount ->getRootId ()) {
299300 return true ;
300301 }
301302 $ internalMountPath = $ mount ->getRootInternalPath ();
302303
303304 return $ internalMountPath === '' || substr ($ internalPath , 0 , strlen ($ internalMountPath ) + 1 ) === $ internalMountPath . '/ ' ;
304305 });
306+
307+ return array_map (function (ICachedMountInfo $ mount ) use ($ internalPath ) {
308+ return new CachedMountFileInfo (
309+ $ mount ->getUser (),
310+ $ mount ->getStorageId (),
311+ $ mount ->getRootId (),
312+ $ mount ->getMountPoint (),
313+ $ mount ->getMountId (),
314+ $ mount ->getRootInternalPath (),
315+ $ internalPath
316+ );
317+ }, $ filteredMounts );
305318 }
306319
307320 /**
0 commit comments