diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 17c6e9d572b1e..19b6e048f9c64 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -47,6 +47,7 @@ use OCP\Util; use Psr\Log\LoggerInterface; use function str_starts_with; +use function strlen; /** * Class DefaultShareProvider @@ -869,7 +870,9 @@ private function _getSharedWith( $nonChildPath = '/'; if ($path !== null) { - $path = str_replace('/' . $userId . '/files', '', $path); + if (str_starts_with($path, '/' . $userId . '/files')) { + $path = substr($path, strlen('/' . $userId . '/files')); + } $path = rtrim($path, '/'); if ($path !== '') {