diff options
author | Zaq? Wiedmann <zaquestion@gmail.com> | 2020-01-09 19:48:15 -0800 |
---|---|---|
committer | Matt Holt <mholt@users.noreply.github.com> | 2020-01-09 20:48:15 -0700 |
commit | 3dcc34d3418d3ef5835eac512a52226e47727cfb (patch) | |
tree | d181a5c9741379c1576dbf8d8272aa31a6e0e533 /caddyconfig | |
parent | 871abf1053e99274e7336db3143ca5eb17013e38 (diff) |
caddyfile: advance cursor for claimed token in NewFromNextTokens() (#2971)
When we append a token to the new dispenser, we need to consume it in the parent, too; otherwise it gets scanned twice, which in this case messed up the nesting count which got decremented once too many times.
Diffstat (limited to 'caddyconfig')
-rwxr-xr-x | caddyconfig/caddyfile/dispenser.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/caddyconfig/caddyfile/dispenser.go b/caddyconfig/caddyfile/dispenser.go index 6afbd77..5b90b73 100755 --- a/caddyconfig/caddyfile/dispenser.go +++ b/caddyconfig/caddyfile/dispenser.go @@ -275,6 +275,10 @@ func (d *Dispenser) NewFromNextTokens() *Dispenser { if openedBlock { // include closing brace accordingly tkns = append(tkns, d.Token()) + // since NewFromNextTokens is intended to consume the entire + // directive, we must call Next() here and consume the closing + // curly brace + d.Next() } return NewDispenser(tkns) } |