mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +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 === "..") {
|
||||||
|
|
|
@ -47,6 +47,12 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
["/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