Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/private/Share20/DefaultShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
use OCP\Util;
use Psr\Log\LoggerInterface;
use function str_starts_with;
use function strlen;

/**
* Class DefaultShareProvider
Expand Down Expand Up @@ -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'));
}
Comment on lines +873 to +875
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (str_starts_with($path, '/' . $userId . '/files')) {
$path = substr($path, strlen('/' . $userId . '/files'));
}
$prefix = '/' . $userId . '/files';
if (str_starts_with($path, $prefix)) {
$path = substr($path, strlen($prefix));
}

To avoid that they get out-of-sync accidentally.

$path = rtrim($path, '/');

if ($path !== '') {
Expand Down
Loading