Skip to content

Commit

Permalink
rewrite: Avoid panic on bad arg count for uri (#6571)
Browse files Browse the repository at this point in the history
  • Loading branch information
mister-turtle committed Sep 13, 2024
1 parent 2d12fb7 commit 21f9c20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/caddyhttp/rewrite/caddyfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func parseCaddyfileURI(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, err

switch args[0] {
case "strip_prefix":
if len(args) > 2 {
if len(args) != 2 {
return nil, h.ArgErr()
}
rewr.StripPathPrefix = args[1]
Expand All @@ -115,7 +115,7 @@ func parseCaddyfileURI(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, err
}

case "strip_suffix":
if len(args) > 2 {
if len(args) != 2 {
return nil, h.ArgErr()
}
rewr.StripPathSuffix = args[1]
Expand Down

0 comments on commit 21f9c20

Please sign in to comment.