Skip to content

Commit 0d8526b

Browse files
committed
gzip: Allow empty extension (caddyserver#509)
1 parent e74558e commit 0d8526b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

caddy/setup/gzip.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func gzipParse(c *Controller) ([]gzip.Config, error) {
4747
return configs, c.ArgErr()
4848
}
4949
for _, e := range exts {
50-
if !strings.HasPrefix(e, ".") && e != gzip.ExtWildCard {
50+
if !strings.HasPrefix(e, ".") && e != gzip.ExtWildCard && e != "" {
5151
return configs, fmt.Errorf(`gzip: invalid extension "%v" (must start with dot)`, e)
5252
}
5353
extFilter.Exts.Add(e)

caddy/setup/gzip_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ func TestGzip(t *testing.T) {
5050
level 1
5151
}
5252
gzip`, false},
53+
{`gzip {
54+
ext ""
55+
}`, false},
5356
{`gzip { not /file
5457
ext .html
5558
level 1

0 commit comments

Comments
 (0)