mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 05:06:51 +00:00
Simplify references parsing
This commit is contained in:
@ -148,7 +148,7 @@ func (im *imapMailbox) CreateMessage(flags []string, date time.Time, body imap.L
|
||||
if len(referenceList) > 0 {
|
||||
lastReference := referenceList[len(referenceList)-1]
|
||||
// In case we are using a mail client which corrupts headers, try "References" too.
|
||||
re := regexp.MustCompile("<[a-zA-Z0-9-_=]*@protonmail.internalid>")
|
||||
re := regexp.MustCompile(`(?U)<.*@protonmail.internalid>`)
|
||||
match := re.FindString(lastReference)
|
||||
if match != "" {
|
||||
internalID = match[1 : len(match)-len("@protonmail.internalid>")]
|
||||
|
||||
@ -373,9 +373,9 @@ func (su *smtpUser) handleReferencesHeader(m *pmapi.Message) (draftID, parentID
|
||||
if !strings.Contains(reference, "@protonmail.internalid") {
|
||||
newReferences = append(newReferences, reference)
|
||||
} else { // internalid is the parentID.
|
||||
idMatch := regexp.MustCompile("[a-zA-Z0-9-_=]*@protonmail.internalid").FindString(reference)
|
||||
idMatch := regexp.MustCompile(`(?U)<.*@protonmail.internalid>`).FindString(reference)
|
||||
if idMatch != "" {
|
||||
lastID := idMatch[0 : len(idMatch)-len("@protonmail.internalid")]
|
||||
lastID := idMatch[1 : len(idMatch)-len("@protonmail.internalid>")]
|
||||
filter := &pmapi.MessagesFilter{ID: []string{lastID}}
|
||||
if su.addressID != "" {
|
||||
filter.AddressID = su.addressID
|
||||
|
||||
@ -12,8 +12,8 @@ Feature: SMTP sending of HTML messages
|
||||
Content-Disposition: inline
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Content-Type: text/html; charset=utf-8
|
||||
In-Reply-To: base64hashOfSomeMessage@protonmail.internalID
|
||||
References: base64hashOfSomeConversation@protonmail.internalID base64hashOfSomeConversation@protonmail.conversationID
|
||||
In-Reply-To: <base64hashOfSomeMessage@protonmail.internalID>
|
||||
References: <base64hashOfSomeConversation@protonmail.internalID> <base64hashOfSomeConversation@protonmail.conversationID>
|
||||
|
||||
<html><body>This is body of <b>HTML mail</b> without attachment<body></html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user