mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-14 18:26:27 +08:00
caddyfile: Fix comparing if two tokens are on the same line (#5626)
* fix comparing if two tokens are on the same line * compare tokens from copies when importing
This commit is contained in:
@ -464,7 +464,7 @@ func (p *parser) doImport(nesting int) error {
|
||||
// format, won't check for nesting correctness or any other error, that's what parser does.
|
||||
if !maybeSnippet && nesting == 0 {
|
||||
// first of the line
|
||||
if i == 0 || importedTokens[i-1].File != token.File || importedTokens[i-1].Line+importedTokens[i-1].NumLineBreaks() < token.Line {
|
||||
if i == 0 || isNextOnNewLine(tokensCopy[i-1], token) {
|
||||
index = 0
|
||||
} else {
|
||||
index++
|
||||
|
Reference in New Issue
Block a user