From 8312caafc5918d7cdad4827f76d5326605350552 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 !== '') {