fileserver: Reject ADS and short name paths; trim trailing dots and spaces on Windows (#5148)

* fileserver: Reject ADS and short name paths

* caddyhttp: Trim trailing space and dot on Windows

Windows ignores trailing dots and spaces in filenames.

* Fix test

* Adjust path filters

* Revert Windows test

* Actually revert the test

* Just check for colons
This commit is contained in:
Matt Holt
2022-10-18 21:55:25 -06:00
committed by GitHub
parent 72e7edda1f
commit 4bf6cb4199
2 changed files with 15 additions and 1 deletions

View File

@ -87,7 +87,7 @@ func TestSanitizedPathJoin(t *testing.T) {
}
actual := SanitizedPathJoin(tc.inputRoot, u.Path)
if actual != tc.expect {
t.Errorf("Test %d: SanitizedPathJoin('%s', '%s') => %s (expected '%s')",
t.Errorf("Test %d: SanitizedPathJoin('%s', '%s') => '%s' (expected '%s')",
i, tc.inputRoot, tc.inputPath, actual, tc.expect)
}
}