mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 21:53:48 +03:00
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.
This commit is contained in:
parent
871abf1053
commit
3dcc34d341
1 changed files with 4 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue