actually copy data to file

This commit is contained in:
Seán C McCord 2023-10-01 22:30:42 -04:00
parent db22435efb
commit 2ab1916fe9
Signed by: scm
GPG key ID: 4AF67648FB0336A6

View file

@ -201,6 +201,21 @@ func (session *Session) Data(r io.Reader) error {
} }
}() }()
n, err := io.Copy(f, r)
if err != nil {
session.log.Error("failed to receive message data to temporary data file", zap.Error(err))
return ErrBadGateway
}
session.log.Sugar().Debugf("received message with %d bytes", n)
if _, err := f.Seek(0, 0); err != nil {
session.log.Error("failed to seek to beginning of temporary data file", zap.Error(err))
return ErrBadGateway
}
_, action, err := session.rspam.BodyReadFrom(f) _, action, err := session.rspam.BodyReadFrom(f)
if err != nil { if err != nil {
session.log.Error("rspamd failed to process message body", zap.Error(err)) session.log.Error("rspamd failed to process message body", zap.Error(err))