Skip to content

Commit ed18c44

Browse files
committed
fix: remove user part only at the beginning of path
Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
1 parent 0cd3755 commit ed18c44

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/private/Share20/DefaultShareProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
use OCP\Util;
4848
use Psr\Log\LoggerInterface;
4949
use function str_starts_with;
50+
use function strlen;
5051

5152
/**
5253
* Class DefaultShareProvider
@@ -869,7 +870,10 @@ private function _getSharedWith(
869870

870871
$nonChildPath = '/';
871872
if ($path !== null) {
872-
$path = str_replace('/' . $userId . '/files', '', $path);
873+
$prefix = '/' . $userId . '/files';
874+
if (str_starts_with($path, $prefix)) {
875+
$path = substr($path, strlen($prefix));
876+
}
873877
$path = rtrim($path, '/');
874878

875879
if ($path !== '') {

0 commit comments

Comments
 (0)