mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +00:00
fix(GODT-2598): Map Message Size Error to Gluon Error
Prevents messages with invalid size from ending up in the recovery mailbox.
This commit is contained in:
@ -20,6 +20,7 @@ package user
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/mail"
|
||||
"sync/atomic"
|
||||
@ -350,7 +351,13 @@ func (conn *imapConnector) CreateMessage(
|
||||
wantFlags = wantFlags.Add(proton.MessageFlagReplied)
|
||||
}
|
||||
|
||||
return conn.importMessage(ctx, literal, wantLabelIDs, wantFlags, unread)
|
||||
msg, literal, err := conn.importMessage(ctx, literal, wantLabelIDs, wantFlags, unread)
|
||||
if err != nil && errors.Is(err, proton.ErrImportSizeExceeded) {
|
||||
// Remap error so that Gluon does not put this message in the recovery mailbox.
|
||||
err = fmt.Errorf("%v: %w", err, connector.ErrMessageSizeExceedsLimits)
|
||||
}
|
||||
|
||||
return msg, literal, err
|
||||
}
|
||||
|
||||
func (conn *imapConnector) GetMessageLiteral(ctx context.Context, id imap.MessageID) ([]byte, error) {
|
||||
|
||||
Reference in New Issue
Block a user