From ed18c4437426817a5faadebe3cdd3298e632da8c Mon Sep 17 00:00:00 2001 From: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> Date: Fri, 13 Feb 2026 17:16:37 +0100 Subject: [PATCH] fix: remove user part only at the beginning of path Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> --- lib/private/Share20/DefaultShareProvider.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 17c6e9d572b1e..3a69c15eba509 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,10 @@ private function _getSharedWith( $nonChildPath = '/'; if ($path !== null) { - $path = str_replace('/' . $userId . '/files', '', $path); + $prefix = '/' . $userId . '/files'; + if (str_starts_with($path, $prefix)) { + $path = substr($path, strlen($prefix)); + } $path = rtrim($path, '/'); if ($path !== '') {