mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 22:56:48 +00:00
GODT-876 Set default from if empty for importing draft
This commit is contained in:
@ -118,12 +118,20 @@ func (p *PMAPIProvider) transferDraft(rules transferRules, progress *Progress, m
|
||||
progress.messageImported(msg.ID, importedID, err)
|
||||
}
|
||||
|
||||
func (p *PMAPIProvider) importDraft(msg Message, globalMailbox *Mailbox) (string, error) {
|
||||
func (p *PMAPIProvider) importDraft(msg Message, globalMailbox *Mailbox) (string, error) { //nolint[funlen]
|
||||
message, attachmentReaders, err := p.parseMessage(msg)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "failed to parse message")
|
||||
}
|
||||
|
||||
if message.Sender == nil {
|
||||
mainAddress := p.client().Addresses().Main()
|
||||
message.Sender = &mail.Address{
|
||||
Name: mainAddress.DisplayName,
|
||||
Address: mainAddress.Email,
|
||||
}
|
||||
}
|
||||
|
||||
// Trying to encrypt an encrypted draft will return an error;
|
||||
// users are forbidden to import messages encrypted with foreign keys to drafts.
|
||||
if message.IsEncrypted() {
|
||||
|
||||
Reference in New Issue
Block a user