Other: Do not decode message body during send record hashing
When calculating the hash for the body to match against sent email to avoid duplicate addition to the sent folder, do not decode the actual contents of the body. It is possible that certain attachments are not formed correctly but can still accepted by the backend. Trimming spaces and \r characters is enough to hash the message and match it later on. This also speeds the process up as we no longer have to perform encoding conversions.
This commit is contained in:
parent
4b3d4690e8
commit
3499fbd758
|
@ -275,12 +275,10 @@ func getMessageHash(b []byte) (string, error) {
|
|||
return err
|
||||
}
|
||||
|
||||
body, err := section.DecodedBody()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := h.Write(bytes.TrimSpace(body)); err != nil {
|
||||
body := section.Body()
|
||||
body = bytes.ReplaceAll(body, []byte{'\r'}, nil)
|
||||
body = bytes.TrimSpace(body)
|
||||
if _, err := h.Write(body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue