File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 2424use OCP \Share \Exceptions \IllegalIDChangeException ;
2525use OCP \Share \IAttributes ;
2626use OCP \Share \IShare ;
27+ use function strlen ;
2728
2829/**
2930 * Class ShareWrapperRequest
@@ -383,10 +384,14 @@ public function getSharedWithByPath(
383384 $ qb ->limitNull ('parent ' , false );
384385 $ childAlias = $ qb ->leftJoinShareChild (CoreQueryBuilder::SHARE );
385386
387+ $ userId = $ federatedUser ->getUserId ();
388+ $ prefix = '/ ' . $ userId . '/files ' ;
389+ if (str_starts_with ($ path , $ prefix )) {
390+ $ path = substr ($ path , strlen ($ prefix ));
391+ }
392+ $ path = rtrim ($ path , '/ ' );
393+
386394 if ($ forChildren ) {
387- $ userId = $ federatedUser ->getUserId ();
388- $ path = str_replace ('/ ' . $ userId . '/files ' , '' , $ path );
389- $ path = rtrim ($ path , '/ ' );
390395 $ childPathTemplate = $ this ->getQueryBuilder ()->getConnection ()->escapeLikeParameter ($ path ) . '/_% ' ;
391396
392397 $ qb ->limitToFileTargetLike ($ childPathTemplate , $ childAlias );
You can’t perform that action at this time.
0 commit comments