Commit 0d8526b7 authored by Matthew Holt's avatar Matthew Holt

gzip: Allow empty extension (#509)

parent e74558ea
...@@ -47,7 +47,7 @@ func gzipParse(c *Controller) ([]gzip.Config, error) { ...@@ -47,7 +47,7 @@ func gzipParse(c *Controller) ([]gzip.Config, error) {
return configs, c.ArgErr() return configs, c.ArgErr()
} }
for _, e := range exts { 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) return configs, fmt.Errorf(`gzip: invalid extension "%v" (must start with dot)`, e)
} }
extFilter.Exts.Add(e) extFilter.Exts.Add(e)
......
...@@ -50,6 +50,9 @@ func TestGzip(t *testing.T) { ...@@ -50,6 +50,9 @@ func TestGzip(t *testing.T) {
level 1 level 1
} }
gzip`, false}, gzip`, false},
{`gzip {
ext ""
}`, false},
{`gzip { not /file {`gzip { not /file
ext .html ext .html
level 1 level 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment