Skip to content

Commit 73c6b17

Browse files
committed
fix(View): Normalize path in getAbsolutePath
This allow to match files more consistently in HookConnector::getNodeForPath Signed-off-by: Louis Chmn <[email protected]>
1 parent b344b53 commit 73c6b17

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

lib/private/Files/View.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use OC\Files\Mount\MoveableMount;
1212
use OC\Files\Storage\Storage;
1313
use OC\Files\Storage\Wrapper\Quota;
14+
use OC\Files\Utils\PathHelper;
1415
use OC\Share\Share;
1516
use OC\User\LazyUser;
1617
use OC\User\Manager as UserManager;
@@ -92,13 +93,7 @@ public function getAbsolutePath($path = '/'): ?string {
9293
return null;
9394
}
9495
$this->assertPathLength($path);
95-
if ($path === '') {
96-
$path = '/';
97-
}
98-
if ($path[0] !== '/') {
99-
$path = '/' . $path;
100-
}
101-
return $this->fakeRoot . $path;
96+
return PathHelper::normalizePath($this->fakeRoot . '/' . $path);
10297
}
10398

10499
/**

tests/lib/Files/ViewTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,11 +917,11 @@ public function testPartFileInfo(): void {
917917

918918
public static function absolutePathProvider(): array {
919919
return [
920-
['/files/', ''],
920+
['/files', ''],
921921
['/files/0', '0'],
922922
['/files/false', 'false'],
923923
['/files/true', 'true'],
924-
['/files/', '/'],
924+
['/files', '/'],
925925
['/files/test', 'test'],
926926
['/files/test', '/test'],
927927
];

0 commit comments

Comments
 (0)