1
1
Fork 0
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:
J. King 2021-06-19 19:46:10 -04:00
parent dfaf44ac68
commit 23749b51aa
2 changed files with 15 additions and 8 deletions

View file

@ -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 === "..") {

View file

@ -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],
]; ];
} }