From 0d8526b7d9254e3f6d657b74b12ee000aa18f3ce Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Fri, 15 Jan 2016 11:59:05 -0700 Subject: [PATCH] gzip: Allow empty extension (#509) --- caddy/setup/gzip.go | 2 +- caddy/setup/gzip_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/caddy/setup/gzip.go b/caddy/setup/gzip.go index 40c81252..7d09fe01 100644 --- a/caddy/setup/gzip.go +++ b/caddy/setup/gzip.go @@ -47,7 +47,7 @@ func gzipParse(c *Controller) ([]gzip.Config, error) { return configs, c.ArgErr() } for _, e := range exts { - if !strings.HasPrefix(e, ".") && e != gzip.ExtWildCard { + if !strings.HasPrefix(e, ".") && e != gzip.ExtWildCard && e != "" { return configs, fmt.Errorf(`gzip: invalid extension "%v" (must start with dot)`, e) } extFilter.Exts.Add(e) diff --git a/caddy/setup/gzip_test.go b/caddy/setup/gzip_test.go index 36eeb0ae..4c24ab0a 100644 --- a/caddy/setup/gzip_test.go +++ b/caddy/setup/gzip_test.go @@ -50,6 +50,9 @@ func TestGzip(t *testing.T) { level 1 } gzip`, false}, + {`gzip { + ext "" + }`, false}, {`gzip { not /file ext .html level 1