1
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-16 21:56:40 -05:00

rewrite: Avoid panic on bad arg count for uri (#6571)

This commit is contained in:
mister-turtle 2024-09-13 08:22:03 +01:00 committed by GitHub
parent 2d12fb7ac6
commit 21f9c20a04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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