mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 05:06:51 +00:00
Other: fix live test: API sanitize timestamp
This commit is contained in:
@ -69,8 +69,9 @@ Feature: IMAP fetch messages
|
||||
And there is IMAP client selected in "Folders/mbox"
|
||||
When IMAP client sends command "FETCH 1:* rfc822"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response contains "Date: Fri, 13 Aug 1982"
|
||||
And IMAP response contains "X-Original-Date: Sun, 20 Jul 1969"
|
||||
And IMAP response contains "\nDate: Fri, 13 Aug 1982"
|
||||
And IMAP response contains "\nX-Pm-Date: Thu, 01 Jan 1970"
|
||||
And IMAP response contains "\nX-Original-Date: Sun, 20 Jul 1969"
|
||||
# We had bug to incorectly set empty date, so let's make sure
|
||||
# there is no reference anywhere in the response.
|
||||
And IMAP response does not contain "Date: Thu, 01 Jan 1970"
|
||||
And IMAP response does not contain "\nDate: Thu, 01 Jan 1970"
|
||||
|
||||
@ -115,7 +115,7 @@ func thereAreMessagesInMailboxesForAddressOfUser(mailboxNames, bddAddressID, bdd
|
||||
if column == "deleted" {
|
||||
hasDeletedFlag = cell.Value == "true"
|
||||
}
|
||||
err := processMessageTableCell(column, cell.Value, account.Username(), message, header)
|
||||
err := processMessageTableCell(column, cell.Value, account.Username(), message, &header)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -151,7 +151,7 @@ func thereAreMessagesInMailboxesForAddressOfUser(mailboxNames, bddAddressID, bdd
|
||||
return nil
|
||||
}
|
||||
|
||||
func processMessageTableCell(column, cellValue, username string, message *pmapi.Message, header textproto.MIMEHeader) error {
|
||||
func processMessageTableCell(column, cellValue, username string, message *pmapi.Message, header *textproto.MIMEHeader) error {
|
||||
switch column {
|
||||
case "deleted", "id": // it is processed in the main function
|
||||
case "from":
|
||||
@ -187,8 +187,13 @@ func processMessageTableCell(column, cellValue, username string, message *pmapi.
|
||||
if err != nil {
|
||||
return internalError(err, "parsing time")
|
||||
}
|
||||
message.Time = date.Unix()
|
||||
header.Set("Date", date.Format(time.RFC1123Z))
|
||||
// API will sanitize the date to not have negative timestamp
|
||||
if date.After(time.Unix(0, 0)) {
|
||||
message.Time = date.Unix()
|
||||
} else {
|
||||
message.Time = 0
|
||||
}
|
||||
case "n attachments":
|
||||
numAttachments, err := strconv.Atoi(cellValue)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user