caddyfile: Correctly close the heredoc when the closing marker appears immediately (#6062)

This commit is contained in:
bbaa 2024-01-25 22:55:00 +08:00 committed by GitHub
parent 7c48b5fdbb
commit c369df5c37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View file

@ -186,7 +186,7 @@ func (l *lexer) next() (bool, error) {
}
// check if we're done, i.e. that the last few characters are the marker
if len(val) > len(heredocMarker) && heredocMarker == string(val[len(val)-len(heredocMarker):]) {
if len(val) >= len(heredocMarker) && heredocMarker == string(val[len(val)-len(heredocMarker):]) {
// set the final value
val, err = l.finalizeHeredoc(val, heredocMarker)
if err != nil {