0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

gzip: Allow empty extension (#509)

This commit is contained in:
Matthew Holt 2016-01-15 11:59:05 -07:00
parent e74558eaea
commit 0d8526b7d9
2 changed files with 4 additions and 1 deletions

View file

@ -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)

View file

@ -50,6 +50,9 @@ func TestGzip(t *testing.T) {
level 1
}
gzip`, false},
{`gzip {
ext ""
}`, false},
{`gzip { not /file
ext .html
level 1