diff options
author | Matthew Holt <[email protected]> | 2023-07-08 13:42:13 -0600 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2023-07-08 13:42:13 -0600 |
commit | 66114cb155f2a975ecdc9f3d2d89a9df1142791a (patch) | |
tree | 627a5b52df731e62248bfe4ce0cb5ba5018394aa /modules/caddyhttp/matchers_test.go | |
parent | 7914ba3573fa8eeb05f193fffde1a1c1493e3d0b (diff) | |
download | caddy-66114cb155f2a975ecdc9f3d2d89a9df1142791a.tar.gz caddy-66114cb155f2a975ecdc9f3d2d89a9df1142791a.zip |
caddyhttp: Trim dot/space only on Windows (fix #5613)
Follow-up to #2917. Path matcher needs to trim dots and spaces but only
on Windows.
Diffstat (limited to 'modules/caddyhttp/matchers_test.go')
-rw-r--r-- | modules/caddyhttp/matchers_test.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/modules/caddyhttp/matchers_test.go b/modules/caddyhttp/matchers_test.go index 4f5da69a3..041975d80 100644 --- a/modules/caddyhttp/matchers_test.go +++ b/modules/caddyhttp/matchers_test.go @@ -21,6 +21,7 @@ import ( "net/http/httptest" "net/url" "os" + "runtime" "testing" "github.com/caddyserver/caddy/v2" @@ -254,11 +255,6 @@ func TestPathMatcher(t *testing.T) { expect: true, }, { - match: MatchPath{"*.php"}, - input: "/foo/index.php. .", - expect: true, - }, - { match: MatchPath{"/foo/bar.txt"}, input: "/foo/BAR.txt", expect: true, @@ -435,8 +431,10 @@ func TestPathMatcher(t *testing.T) { func TestPathMatcherWindows(t *testing.T) { // only Windows has this bug where it will ignore - // trailing dots and spaces in a filename, but we - // test for it on all platforms to be more consistent + // trailing dots and spaces in a filename + if runtime.GOOS != "windows" { + return + } req := &http.Request{URL: &url.URL{Path: "/index.php . . .."}} repl := caddy.NewReplacer() |