mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
caddyhttp: Add test cases to corpus (#6374)
* caddyhttp: Add test case to corpus * One more test case * Clean up stray comment * More tests
This commit is contained in:
parent
e7ecc7ede2
commit
198f4385d2
1 changed files with 25 additions and 1 deletions
|
@ -94,7 +94,31 @@ func TestSanitizedPathJoin(t *testing.T) {
|
||||||
inputRoot: "C:\\www",
|
inputRoot: "C:\\www",
|
||||||
inputPath: "/D:\\foo\\bar",
|
inputPath: "/D:\\foo\\bar",
|
||||||
expect: filepath.Join("C:\\www", "D:\\foo\\bar"),
|
expect: filepath.Join("C:\\www", "D:\\foo\\bar"),
|
||||||
expectWindows: filepath.Join("C:\\www"), // inputPath fails IsLocal on Windows
|
expectWindows: "C:\\www", // inputPath fails IsLocal on Windows
|
||||||
|
},
|
||||||
|
{
|
||||||
|
inputRoot: `C:\www`,
|
||||||
|
inputPath: `/..\windows\win.ini`,
|
||||||
|
expect: `C:\www/..\windows\win.ini`,
|
||||||
|
expectWindows: `C:\www`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
inputRoot: `C:\www`,
|
||||||
|
inputPath: `/..\..\..\..\..\..\..\..\..\..\windows\win.ini`,
|
||||||
|
expect: `C:\www/..\..\..\..\..\..\..\..\..\..\windows\win.ini`,
|
||||||
|
expectWindows: `C:\www`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
inputRoot: `C:\www`,
|
||||||
|
inputPath: `/..%5cwindows%5cwin.ini`,
|
||||||
|
expect: `C:\www/..\windows\win.ini`,
|
||||||
|
expectWindows: `C:\www`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
inputRoot: `C:\www`,
|
||||||
|
inputPath: `/..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5cwindows%5cwin.ini`,
|
||||||
|
expect: `C:\www/..\..\..\..\..\..\..\..\..\..\windows\win.ini`,
|
||||||
|
expectWindows: `C:\www`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// https://github.com/golang/go/issues/56336#issuecomment-1416214885
|
// https://github.com/golang/go/issues/56336#issuecomment-1416214885
|
||||||
|
|
Loading…
Reference in a new issue