mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Tests for path resolution
This commit is contained in:
parent
dfaf44ac68
commit
23749b51aa
2 changed files with 15 additions and 8 deletions
|
@ -159,9 +159,10 @@ class Daemon {
|
||||||
if ($cwd === false) {
|
if ($cwd === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$path = substr($cwd, 1)."/".$path;
|
$path = explode("/", substr($cwd, 1)."/".$path);
|
||||||
|
} else {
|
||||||
|
$path = explode("/", substr($path, 1));
|
||||||
}
|
}
|
||||||
$path = explode("/", substr($path, 1));
|
|
||||||
$out = [];
|
$out = [];
|
||||||
foreach ($path as $p) {
|
foreach ($path as $p) {
|
||||||
if ($p === "..") {
|
if ($p === "..") {
|
||||||
|
|
|
@ -41,12 +41,18 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
|
||||||
public function providePathResolutions(): iterable {
|
public function providePathResolutions(): iterable {
|
||||||
return [
|
return [
|
||||||
["/", "/home/me", "/"],
|
["/", "/home/me", "/"],
|
||||||
["/.", "/home/me", "/"],
|
["/.", "/home/me", "/"],
|
||||||
["/..", "/home/me", "/"],
|
["/..", "/home/me", "/"],
|
||||||
["/run", "/home/me", "/run"],
|
["/run", "/home/me", "/run"],
|
||||||
["/./run", "/home/me", "/run"],
|
["/./run", "/home/me", "/run"],
|
||||||
["/../run", "/home/me", "/run"],
|
["/../run", "/home/me", "/run"],
|
||||||
|
["/run/../run", "/home/me", "/run"],
|
||||||
|
["/run/./run", "/home/me", "/run/run"],
|
||||||
|
["run", "/home/me", "/home/me/run"],
|
||||||
|
["run/..", "/home/me", "/home/me"],
|
||||||
|
[".", "/", "/"],
|
||||||
|
[".", false, false],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue