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 {
|
if openedBlock {
|
||||||
// include closing brace accordingly
|
// include closing brace accordingly
|
||||||
tkns = append(tkns, d.Token())
|
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)
|
return NewDispenser(tkns)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue