fix(View): Normalize path in `getAbsolutePath`

This allow to match files more consistently in HookConnector::getNodeForPath

Signed-off-by: Louis Chmn <louis@chmn.me>
pull/56223/head
Louis Chmn 2025-11-06 10:57:19 +07:00 committed by Louis
parent b344b5323d
commit 73c6b17fae
2 changed files with 4 additions and 9 deletions

@ -11,6 +11,7 @@ use Icewind\Streams\CallbackWrapper;
use OC\Files\Mount\MoveableMount;
use OC\Files\Storage\Storage;
use OC\Files\Storage\Wrapper\Quota;
use OC\Files\Utils\PathHelper;
use OC\Share\Share;
use OC\User\LazyUser;
use OC\User\Manager as UserManager;
@ -92,13 +93,7 @@ class View {
return null;
}
$this->assertPathLength($path);
if ($path === '') {
$path = '/';
}
if ($path[0] !== '/') {
$path = '/' . $path;
}
return $this->fakeRoot . $path;
return PathHelper::normalizePath($this->fakeRoot . '/' . $path);
}
/**

@ -917,11 +917,11 @@ class ViewTest extends \Test\TestCase {
public static function absolutePathProvider(): array {
return [
['/files/', ''],
['/files', ''],
['/files/0', '0'],
['/files/false', 'false'],
['/files/true', 'true'],
['/files/', '/'],
['/files', '/'],
['/files/test', 'test'],
['/files/test', '/test'],
];