mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +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
|
||||
|
||||
Reference in New Issue
Block a user