actually copy data to file
This commit is contained in:
parent
db22435efb
commit
2ab1916fe9
1 changed files with 15 additions and 0 deletions
|
@ -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)
|
||||
if err != nil {
|
||||
session.log.Error("rspamd failed to process message body", zap.Error(err))
|
||||
|
|
Loading…
Reference in a new issue