@marcel91200 / caddy Mirror · read-only / commits / c054a818
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

fileserver: Fix newly-introduced failing test on Linux (#3625)

* fileserver: First attempt to fix failing test on Linux I think I updated the wrong test case before * Make new test function I guess what we really are trying to test is the case insensitivity of firstSplit. So a new test function is better for that.

Matt Holt committed Aug 1, 2020 at 12:43 UTC c054a818a1d6fee61cebc48b4286bb40d0553f4c
1 file changed +9 -5
modules/caddyhttp/fileserver/matcher_test.go
+9 -5
@@ -71,11 +71,6 @@ func TestPHPFileMatcher(t *testing.T) {
71 expectedPath: "/foo.php.php/index.php",
72 matched: true,
73 },
74 - {
75 - path: "/foo.php.PHP/index.php",
76 - expectedPath: "/foo.php.PHP/index.php",
77 - matched: true,
78 - },
74 {
75 // See https://github.com/caddyserver/caddy/issues/3623
76 path: "/%E2%C3",
@@ -115,3 +110,12 @@ func TestPHPFileMatcher(t *testing.T) {
110 }
111 }
112 }
113 +
114 +func TestFirstSplit(t *testing.T) {
115 + m := MatchFile{SplitPath: []string{".php"}}
116 + actual := m.firstSplit("index.PHP/somewhere")
117 + expected := "index.PHP"
118 + if actual != expected {
119 + t.Errorf("Expected %s but got %s", expected, actual)
120 + }
121 +}