replacer: {file.*} global placeholder strips trailing newline (#6411)

Co-authored-by: Kanashimia <chad@redpilled.dev>
This commit is contained in:
Steffen Busch
2024-08-07 21:39:15 +02:00
committed by GitHub
parent 59cbb2c83a
commit b85b6c6469
4 changed files with 21 additions and 0 deletions

View File

@@ -15,6 +15,7 @@
package caddy
import (
"bytes"
"fmt"
"io"
"net/http"
@@ -354,6 +355,8 @@ func (f fileReplacementProvider) replace(key string) (any, bool) {
zap.Error(err))
return nil, true
}
body = bytes.TrimSuffix(body, []byte("\n"))
body = bytes.TrimSuffix(body, []byte("\r"))
return string(body), true
}