caddyfile: Stricter parsing, error for brace on new line (#5505)

This commit is contained in:
Francis Lavoie
2023-04-20 14:43:51 -04:00
committed by GitHub
parent c6ac350a3b
commit 53b6fab125
5 changed files with 533 additions and 521 deletions

View File

@ -520,6 +520,9 @@ func (p *parser) directive() error {
if !p.isNextOnNewLine() && p.Token().wasQuoted == 0 {
return p.Err("Unexpected next token after '{' on same line")
}
if p.isNewLine() {
return p.Err("Unexpected '{' on a new line; did you mean to place the '{' on the previous line?")
}
} else if p.Val() == "{}" {
if p.isNextOnNewLine() && p.Token().wasQuoted == 0 {
return p.Err("Unexpected '{}' at end of line")