mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-22 12:28:45 +08:00
rewrite: Avoid panic on bad arg count for uri
(#6571)
This commit is contained in:
parent
2d12fb7ac6
commit
21f9c20a04
|
@ -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]
|
||||
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue
Block a user