mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-01 04:34:21 -04: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
@ -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…
x
Reference in New Issue
Block a user