mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 12:46:46 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 885fb95454 | |||
| 629d6c5e4d | |||
| 4072205709 | |||
| 5d82c218ca |
12
Changelog.md
12
Changelog.md
@ -2,6 +2,18 @@
|
|||||||
|
|
||||||
Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
||||||
|
|
||||||
|
## [Bridge 1.8.2] James
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* GODT-1175: Bug reporting.
|
||||||
|
|
||||||
|
|
||||||
|
## [Bridge 1.8.1] James
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* GODT-1165: Handle UID FETCH with sequence range of empty mailbox.
|
||||||
|
|
||||||
|
|
||||||
## [Bridge 1.8.0] James
|
## [Bridge 1.8.0] James
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
2
Makefile
2
Makefile
@ -10,7 +10,7 @@ TARGET_OS?=${GOOS}
|
|||||||
.PHONY: build build-ie build-nogui build-ie-nogui build-launcher build-launcher-ie versioner hasher
|
.PHONY: build build-ie build-nogui build-ie-nogui build-launcher build-launcher-ie versioner hasher
|
||||||
|
|
||||||
# Keep version hardcoded so app build works also without Git repository.
|
# Keep version hardcoded so app build works also without Git repository.
|
||||||
BRIDGE_APP_VERSION?=1.8.0+git
|
BRIDGE_APP_VERSION?=1.8.2+git
|
||||||
IE_APP_VERSION?=1.3.3+git
|
IE_APP_VERSION?=1.3.3+git
|
||||||
APP_VERSION:=${BRIDGE_APP_VERSION}
|
APP_VERSION:=${BRIDGE_APP_VERSION}
|
||||||
SRC_ICO:=logo.ico
|
SRC_ICO:=logo.ico
|
||||||
|
|||||||
@ -38,6 +38,11 @@ func (storeMailbox *Mailbox) GetAPIIDsFromUIDRange(start, stop uint32) (apiIDs [
|
|||||||
b := storeMailbox.txGetIMAPIDsBucket(tx)
|
b := storeMailbox.txGetIMAPIDsBucket(tx)
|
||||||
c := b.Cursor()
|
c := b.Cursor()
|
||||||
|
|
||||||
|
// GODT-1153 If the mailbox is empty we should reply BAD to client.
|
||||||
|
if uid, _ := c.Last(); uid == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// If the start range is a wildcard, the range can only refer to the last message in the mailbox.
|
// If the start range is a wildcard, the range can only refer to the last message in the mailbox.
|
||||||
if start == 0 {
|
if start == 0 {
|
||||||
_, apiID := c.Last()
|
_, apiID := c.Last()
|
||||||
@ -74,6 +79,11 @@ func (storeMailbox *Mailbox) GetAPIIDsFromSequenceRange(start, stop uint32) (api
|
|||||||
b := storeMailbox.txGetIMAPIDsBucket(tx)
|
b := storeMailbox.txGetIMAPIDsBucket(tx)
|
||||||
c := b.Cursor()
|
c := b.Cursor()
|
||||||
|
|
||||||
|
// GODT-1153 If the mailbox is empty we should reply BAD to client.
|
||||||
|
if uid, _ := c.Last(); uid == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// If the start range is a wildcard, the range can only refer to the last message in the mailbox.
|
// If the start range is a wildcard, the range can only refer to the last message in the mailbox.
|
||||||
if start == 0 {
|
if start == 0 {
|
||||||
_, apiID := c.Last()
|
_, apiID := c.Last()
|
||||||
@ -318,5 +328,10 @@ func (storeMailbox *Mailbox) GetUIDByHeader(header *mail.Header) (foundUID uint3
|
|||||||
|
|
||||||
func (storeMailbox *Mailbox) txGetFinalUID(b *bolt.Bucket) uint32 {
|
func (storeMailbox *Mailbox) txGetFinalUID(b *bolt.Bucket) uint32 {
|
||||||
uid, _ := b.Cursor().Last()
|
uid, _ := b.Cursor().Last()
|
||||||
|
|
||||||
|
if uid == nil {
|
||||||
|
panic(errors.New("cannot get final UID of empty mailbox"))
|
||||||
|
}
|
||||||
|
|
||||||
return btoi(uid)
|
return btoi(uid)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,17 +27,23 @@ func (m *manager) ReportBug(ctx context.Context, rep ReportBugReq) error {
|
|||||||
rep.ClientType = EmailClientType
|
rep.ClientType = EmailClientType
|
||||||
}
|
}
|
||||||
|
|
||||||
r := m.r(ctx)
|
if rep.Client == "" {
|
||||||
if len(rep.Attachments) == 0 {
|
rep.Client = m.cfg.GetUserAgent()
|
||||||
r = r.SetBody(rep)
|
}
|
||||||
} else {
|
|
||||||
r = r.SetMultipartFormData(rep.GetMultipartFormData())
|
if rep.ClientVersion == "" {
|
||||||
|
rep.ClientVersion = m.cfg.AppVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
r := m.r(ctx).SetMultipartFormData(rep.GetMultipartFormData())
|
||||||
|
|
||||||
for _, att := range rep.Attachments {
|
for _, att := range rep.Attachments {
|
||||||
r = r.SetMultipartField(att.name, att.filename, "application/octet-stream", att.body)
|
r = r.SetMultipartField(att.name, att.filename, "application/octet-stream", att.body)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if _, err := wrapNoConnection(r.Post("/reports/bug")); err != nil {
|
if _, err := wrapNoConnection(r.Post("/reports/bug")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,6 @@ package pmapi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -85,22 +84,3 @@ func TestClient_BugReportWithAttachment(t *testing.T) {
|
|||||||
err := cm.ReportBug(context.Background(), rep)
|
err := cm.ReportBug(context.Background(), rep)
|
||||||
r.NoError(t, err)
|
r.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClient_BugReport(t *testing.T) {
|
|
||||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
|
||||||
r.NoError(t, checkMethodAndPath(req, "POST", "/reports/bug"))
|
|
||||||
|
|
||||||
var bugsReportReq ReportBugReq
|
|
||||||
r.NoError(t, json.NewDecoder(req.Body).Decode(&bugsReportReq))
|
|
||||||
r.Equal(t, testBugReportReq, bugsReportReq)
|
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
|
||||||
fmt.Fprint(w, testBugsBody)
|
|
||||||
}))
|
|
||||||
defer s.Close()
|
|
||||||
|
|
||||||
cm := newManager(newTestConfig(s.URL))
|
|
||||||
|
|
||||||
err := cm.ReportBug(context.Background(), testBugReportReq)
|
|
||||||
r.NoError(t, err)
|
|
||||||
}
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ Feature: IMAP fetch messages
|
|||||||
Then IMAP response is "OK"
|
Then IMAP response is "OK"
|
||||||
And IMAP response has 5 messages
|
And IMAP response has 5 messages
|
||||||
|
|
||||||
Scenario: Fetch first few messages of inbox
|
Scenario: Fetch first few messages of inbox by UID
|
||||||
Given there are 10 messages in mailbox "INBOX" for "user"
|
Given there are 10 messages in mailbox "INBOX" for "user"
|
||||||
And there is IMAP client logged in as "user"
|
And there is IMAP client logged in as "user"
|
||||||
And there is IMAP client selected in "INBOX"
|
And there is IMAP client selected in "INBOX"
|
||||||
@ -108,12 +108,22 @@ Feature: IMAP fetch messages
|
|||||||
And IMAP response has 10 messages
|
And IMAP response has 10 messages
|
||||||
|
|
||||||
# This test is wrong! RFC says it should return "BAD" (GODT-1153).
|
# This test is wrong! RFC says it should return "BAD" (GODT-1153).
|
||||||
Scenario: Fetch of empty mailbox
|
Scenario Outline: Fetch range of empty mailbox
|
||||||
Given there is IMAP client logged in as "user"
|
Given there is IMAP client logged in as "user"
|
||||||
And there is IMAP client selected in "Folders/mbox"
|
And there is IMAP client selected in "Folders/mbox"
|
||||||
When IMAP client fetches "1:*"
|
When IMAP client fetches "<range>"
|
||||||
Then IMAP response is "OK"
|
Then IMAP response is "OK"
|
||||||
And IMAP response has 0 messages
|
And IMAP response has 0 messages
|
||||||
|
When IMAP client fetches by UID "<range>"
|
||||||
|
Then IMAP response is "OK"
|
||||||
|
And IMAP response has 0 messages
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
| range |
|
||||||
|
| 1 |
|
||||||
|
| 1,5,6 |
|
||||||
|
| 1:* |
|
||||||
|
| * |
|
||||||
|
|
||||||
Scenario: Fetch of big mailbox
|
Scenario: Fetch of big mailbox
|
||||||
Given there are 100 messages in mailbox "Folders/mbox" for "user"
|
Given there are 100 messages in mailbox "Folders/mbox" for "user"
|
||||||
@ -123,7 +133,26 @@ Feature: IMAP fetch messages
|
|||||||
Then IMAP response is "OK"
|
Then IMAP response is "OK"
|
||||||
And IMAP response has 100 messages
|
And IMAP response has 100 messages
|
||||||
|
|
||||||
|
Scenario: Fetch of big mailbox by UID
|
||||||
|
Given there are 100 messages in mailbox "Folders/mbox" for "user"
|
||||||
|
And there is IMAP client logged in as "user"
|
||||||
|
And there is IMAP client selected in "Folders/mbox"
|
||||||
|
When IMAP client fetches by UID "1:*"
|
||||||
|
Then IMAP response is "OK"
|
||||||
|
And IMAP response has 100 messages
|
||||||
|
|
||||||
Scenario: Fetch returns also messages that are marked as deleted
|
Scenario: Fetch returns also messages that are marked as deleted
|
||||||
|
Given there are messages in mailbox "Folders/mbox" for "user"
|
||||||
|
| from | to | subject | body | read | starred | deleted |
|
||||||
|
| john.doe@mail.com | user@pm.me | foo | hello | false | false | false |
|
||||||
|
| jane.doe@mail.com | name@pm.me | bar | world | true | true | true |
|
||||||
|
And there is IMAP client logged in as "user"
|
||||||
|
And there is IMAP client selected in "Folders/mbox"
|
||||||
|
When IMAP client fetches "1:*"
|
||||||
|
Then IMAP response is "OK"
|
||||||
|
And IMAP response has 2 message
|
||||||
|
|
||||||
|
Scenario: Fetch by UID returns also messages that are marked as deleted
|
||||||
Given there are messages in mailbox "Folders/mbox" for "user"
|
Given there are messages in mailbox "Folders/mbox" for "user"
|
||||||
| from | to | subject | body | read | starred | deleted |
|
| from | to | subject | body | read | starred | deleted |
|
||||||
| john.doe@mail.com | user@pm.me | foo | hello | false | false | false |
|
| john.doe@mail.com | user@pm.me | foo | hello | false | false | false |
|
||||||
|
|||||||
@ -9,6 +9,7 @@ Feature: Servers are closed when no internet
|
|||||||
Then IMAP client "i1" is logged out
|
Then IMAP client "i1" is logged out
|
||||||
And SMTP client "s1" is logged out
|
And SMTP client "s1" is logged out
|
||||||
Given the internet connection is restored
|
Given the internet connection is restored
|
||||||
|
And 1 second pass
|
||||||
And there is IMAP client "i2" logged in as "user"
|
And there is IMAP client "i2" logged in as "user"
|
||||||
And there is SMTP client "s2" logged in as "user"
|
And there is SMTP client "s2" logged in as "user"
|
||||||
When IMAP client "i2" gets info of "INBOX"
|
When IMAP client "i2" gets info of "INBOX"
|
||||||
@ -20,6 +21,7 @@ Feature: Servers are closed when no internet
|
|||||||
Then IMAP client "i2" is logged out
|
Then IMAP client "i2" is logged out
|
||||||
And SMTP client "s2" is logged out
|
And SMTP client "s2" is logged out
|
||||||
Given the internet connection is restored
|
Given the internet connection is restored
|
||||||
|
And 1 second pass
|
||||||
And there is IMAP client "i3" logged in as "user"
|
And there is IMAP client "i3" logged in as "user"
|
||||||
And there is SMTP client "s3" logged in as "user"
|
And there is SMTP client "s3" logged in as "user"
|
||||||
When IMAP client "i3" gets info of "INBOX"
|
When IMAP client "i3" gets info of "INBOX"
|
||||||
|
|||||||
Reference in New Issue
Block a user