Compare commits

...

7 Commits

Author SHA1 Message Date
7301e5571c fix: return error if parsing header fails GODT-502 2020-06-26 11:35:07 +02:00
7724ca3996 release notes 2020-05-23 09:05:58 +00:00
4393d67bf2 GODT-396 reduce number of exists calls 2020-05-23 09:05:58 +00:00
d222b39793 Apply suggestion to test/features/imap/message/create.feature 2020-05-23 11:07:06 +02:00
6ae78217db Fix appending to Sent 2020-05-23 11:07:06 +02:00
b91c286332 fix gitlab dind 2020-05-23 10:55:57 +02:00
50ed40f205 release notes 2020-05-18 14:02:29 +02:00
13 changed files with 61 additions and 26 deletions

View File

@ -37,6 +37,8 @@ build-ci-image:
- ci/* - ci/*
services: services:
- docker:dind - docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
script: script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker info - docker info

View File

@ -2,7 +2,16 @@
Changelog [format](http://keepachangelog.com/en/1.0.0/) Changelog [format](http://keepachangelog.com/en/1.0.0/)
## [v1.2.7] Emma - beta (2020-04-XXX) ## [v1.2.8] Donghai-fix-append (2020-06-XXX)
### Changed
* GODT-396 reduce number of EXISTS calls
* GODT-143 Allow appending to Sent folder when sender matches account address
### Fixed
* Do not crash when `nil` message header is parsed, it fails instead.
## [v1.2.7] Donghai-fix-sync - (beta 2020-05-07 live 2020-04-20)
### Added ### Added
* IMAP extension MOVE with UIDPLUS support * IMAP extension MOVE with UIDPLUS support
@ -24,6 +33,8 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
### Fixed ### Fixed
* Use correct binary name when finding location of addcert.scpt * Use correct binary name when finding location of addcert.scpt
## [v1.2.6] Donghai - beta (2020-03-31) ## [v1.2.6] Donghai - beta (2020-03-31)
### Added ### Added

View File

@ -15,20 +15,12 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>. // along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
// Code generated by ./release-notes.sh at Mon Apr 6 08:14:14 CEST 2020. DO NOT EDIT. // Code generated by ./release-notes.sh at Thu 21 May 2020 07:59:59 AM CEST. DO NOT EDIT.
package bridge package bridge
const ReleaseNotes = `NOTE: We recommend to reconfigure your email client after upgrading to ensure the best results with the new draft folder support const ReleaseNotes = `
• Faster and more resilient mail synchronization process, especially for large mailboxes
• Added "Alternate Routing" feature to mitigate blocking of Proton Servers
• Added synchronization of draft folder
• Improved event handling when there are frequent changes
• Security improvements for loading dependent libraries
• Minor UI & API communication tweaks
` `
const ReleaseFixedBugs = `• Fixed rare case of sending the same message multiple times in Outlook const ReleaseFixedBugs = `• Fixed ignored import to Sent folder
• Fixed bug in macOS update process; available from next update
` `

View File

@ -126,10 +126,6 @@ func (im *imapMailbox) CreateMessage(flags []string, date time.Time, body imap.L
// We didn't find the message in the store, so we are currently sending it. // We didn't find the message in the store, so we are currently sending it.
logEntry.WithField("time", date).Info("No matching UID, continuing APPEND to Sent") logEntry.WithField("time", date).Info("No matching UID, continuing APPEND to Sent")
// For now we don't import user's own messages to Sent because GetUIDByHeader is not smart enough.
// This will be fixed in GODT-143.
return nil
} }
// This is an APPEND to the Sent folder, so we will set the sent flag // This is an APPEND to the Sent folder, so we will set the sent flag

View File

@ -219,6 +219,11 @@ func (storeMailbox *Mailbox) GetUIDByHeader(header *mail.Header) (foundUID uint3
// in PM message. Message-Id in normal copy/move will be the PM internal ID. // in PM message. Message-Id in normal copy/move will be the PM internal ID.
messageID := header.Get("Message-Id") messageID := header.Get("Message-Id")
// There is nothing to find, when no Message-Id given.
if messageID == "" {
return uint32(0)
}
// The most often situation is that message is APPENDed after it was sent so the // The most often situation is that message is APPENDed after it was sent so the
// Message-ID will be reflected by ExternalID in API message meta-data. // Message-ID will be reflected by ExternalID in API message meta-data.
externalID := strings.Trim(messageID, "<> ") // remove '<>' to improve match externalID := strings.Trim(messageID, "<> ") // remove '<>' to improve match

View File

@ -290,7 +290,6 @@ func (storeMailbox *Mailbox) txCreateOrUpdateMessages(tx *bolt.Tx, msgs []*pmapi
seqNum, seqNum,
msg, msg,
) )
shouldSendMailboxUpdate = true
} }
continue continue
} }

View File

@ -80,7 +80,7 @@ func TestCreateOrUpdateMessageMetadata(t *testing.T) {
a.Equal(t, []*pmapi.Attachment(nil), msg.Attachments) a.Equal(t, []*pmapi.Attachment(nil), msg.Attachments)
a.Equal(t, int64(-1), msg.Size) a.Equal(t, int64(-1), msg.Size)
a.Equal(t, "", msg.MIMEType) a.Equal(t, "", msg.MIMEType)
a.Equal(t, mail.Header(nil), msg.Header) a.Equal(t, make(mail.Header), msg.Header)
// Change the calculated data. // Change the calculated data.
wantSize := int64(42) wantSize := int64(42)

View File

@ -20,6 +20,7 @@ package pmapi
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"net/mail"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
@ -113,6 +114,7 @@ var (
EventItem: EventItem{ID: "hdI7aIgUO1hFplCIcJHB0jShRVsAzS0AB75wGCaiNVeIHXLmaUnt4eJ8l7c7L6uk4g0ZdXhGWG5gfh6HHgAZnw==", Action: EventCreate}, EventItem: EventItem{ID: "hdI7aIgUO1hFplCIcJHB0jShRVsAzS0AB75wGCaiNVeIHXLmaUnt4eJ8l7c7L6uk4g0ZdXhGWG5gfh6HHgAZnw==", Action: EventCreate},
Created: &Message{ Created: &Message{
ID: "hdI7aIgUO1hFplCIcJHB0jShRVsAzS0AB75wGCaiNVeIHXLmaUnt4eJ8l7c7L6uk4g0ZdXhGWG5gfh6HHgAZnw==", ID: "hdI7aIgUO1hFplCIcJHB0jShRVsAzS0AB75wGCaiNVeIHXLmaUnt4eJ8l7c7L6uk4g0ZdXhGWG5gfh6HHgAZnw==",
Header: make(mail.Header),
Subject: "Hey there", Subject: "Hey there",
}, },
}, },
@ -153,6 +155,7 @@ var (
EventItem: EventItem{ID: "msgID1", Action: EventCreate}, EventItem: EventItem{ID: "msgID1", Action: EventCreate},
Created: &Message{ Created: &Message{
ID: "id", ID: "id",
Header: make(mail.Header),
Subject: "Hey there", Subject: "Hey there",
}, },
}, },
@ -160,6 +163,7 @@ var (
EventItem: EventItem{ID: "msgID2", Action: EventCreate}, EventItem: EventItem{ID: "msgID2", Action: EventCreate},
Created: &Message{ Created: &Message{
ID: "id", ID: "id",
Header: make(mail.Header),
Subject: "Hey there again", Subject: "Hey there again",
}, },
}, },

View File

@ -24,6 +24,7 @@ import (
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt"
"io" "io"
"net/http" "net/http"
"net/mail" "net/mail"
@ -32,6 +33,7 @@ import (
"strings" "strings"
pmcrypto "github.com/ProtonMail/gopenpgp/crypto" pmcrypto "github.com/ProtonMail/gopenpgp/crypto"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/openpgp/packet" "golang.org/x/crypto/openpgp/packet"
) )
@ -211,9 +213,13 @@ func (m *Message) UnmarshalJSON(b []byte) error {
if raw.Header != "" && raw.Header != "(No Header)" { if raw.Header != "" && raw.Header != "(No Header)" {
msg, err := mail.ReadMessage(strings.NewReader(raw.Header + "\r\n\r\n")) msg, err := mail.ReadMessage(strings.NewReader(raw.Header + "\r\n\r\n"))
if err == nil { if err != nil {
m.Header = msg.Header logrus.WithField("rawHeader", raw.Header).Trace("Failed to parse header")
return fmt.Errorf("failed to parse header of message %v: %v", m.ID, err.Error())
} }
m.Header = msg.Header
} else {
m.Header = make(mail.Header)
} }
return nil return nil

View File

@ -1,3 +1 @@
• Fixed sync errors due to localization • Fixed ignored import to Sent folder
• Fixed draft deletion
• Fixed re-appearing messages in Outlook

View File

@ -1 +0,0 @@
• Changed directory for storing logs on Linux

View File

@ -36,6 +36,14 @@ graph LR
We want to test Bridge app from outside as much as possible. So we mock server (API), We want to test Bridge app from outside as much as possible. So we mock server (API),
credentials store and call commands to IMAP or SMTP the same way as client would do. credentials store and call commands to IMAP or SMTP the same way as client would do.
## Running tests
In order to run Integration tests just go into the test folder `cd test`
and run `make test`.
You can also test only specific feature (or subset of features) by using `FEATURES` environment
variable: `FEATURES=features/imap/message/create.feature make test`.
## Example test ## Example test
BDD test in gherkin (cucumber) format (https://cucumber.io/docs/gherkin/reference/). BDD test in gherkin (cucumber) format (https://cucumber.io/docs/gherkin/reference/).
@ -99,6 +107,10 @@ we can always be sure what each steps does or should do.
In the code, we separate those parts in its own files to make sure In the code, we separate those parts in its own files to make sure
it's clear how the function should be implemented. it's clear how the function should be implemented.
In the `Given` phase is also generally better to setup data (as `there are messages...`)
first, then users (`there is connected user...`) and then connections (`there is IMAP client...`).
This can prevent some hitches in internal implementation of integration tests.
## API faked by fakeapi or liveapi ## API faked by fakeapi or liveapi
We need to control what server returns. Instead of using raw JSONs, We need to control what server returns. Instead of using raw JSONs,

View File

@ -18,7 +18,6 @@ Feature: IMAP create messages
| from | to | subject | read | | from | to | subject | read |
| [primary] | john.doe@email.com | foo | true | | [primary] | john.doe@email.com | foo | true |
@ignore
Scenario: Creates message sent from user's primary address Scenario: Creates message sent from user's primary address
Given there is IMAP client selected in "Sent" Given there is IMAP client selected in "Sent"
When IMAP client creates message "foo" from address "primary" of "userMoreAddresses" to "john.doe@email.com" with body "hello world" in "Sent" When IMAP client creates message "foo" from address "primary" of "userMoreAddresses" to "john.doe@email.com" with body "hello world" in "Sent"
@ -29,7 +28,6 @@ Feature: IMAP create messages
| [primary] | john.doe@email.com | foo | true | | [primary] | john.doe@email.com | foo | true |
And mailbox "INBOX" for "userMoreAddresses" has no messages And mailbox "INBOX" for "userMoreAddresses" has no messages
@ignore
Scenario: Creates message sent from user's secondary address Scenario: Creates message sent from user's secondary address
Given there is IMAP client selected in "Sent" Given there is IMAP client selected in "Sent"
When IMAP client creates message "foo" from address "secondary" of "userMoreAddresses" to "john.doe@email.com" with body "hello world" in "Sent" When IMAP client creates message "foo" from address "secondary" of "userMoreAddresses" to "john.doe@email.com" with body "hello world" in "Sent"
@ -57,3 +55,16 @@ Feature: IMAP create messages
| from | to | subject | read | | from | to | subject | read |
| notuser@gmail.com | alsonotuser@gmail.com | foo | true | | notuser@gmail.com | alsonotuser@gmail.com | foo | true |
And mailbox "INBOX" for "userMoreAddresses" has no messages And mailbox "INBOX" for "userMoreAddresses" has no messages
# Importing duplicate messages when messageID cannot be found in Sent already.
#
# Previously, we discarded messages for which sender matches account address to
# avoid duplicates, but this led to discarding messages imported through mail client.
Scenario: Imports a similar (duplicate) message to sent
Given there are messages in mailbox "Sent" for "userMoreAddresses"
| from | to | subject | body |
| [primary] | chosen@one.com | Meet the Twins | Hello, Mr. Anderson |
And there is IMAP client selected in "Sent"
When IMAP client creates message "Meet the Twins" from address "primary" of "userMoreAddresses" to "chosen@one.com" with body "Hello, Mr. Anderson" in "Sent"
Then IMAP response is "OK"
And mailbox "Sent" for "userMoreAddresses" has 2 messages