mirror of
https://github.com/moparisthebest/mail
synced 2024-11-26 02:42:17 -05:00
bugfix in cas of channel change
This commit is contained in:
parent
c19aa10fb0
commit
9d3bc51fcf
@ -293,6 +293,14 @@ define(function(require) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!senderPubkey) {
|
||||
// this should only happen if a mail from another channel is in the inbox
|
||||
callback({
|
||||
errMsg: 'No public key for the sender'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// decrypt and verfiy signatures
|
||||
self._crypto.decrypt(email.body, senderPubkey.publicKey, function(err, decrypted) {
|
||||
if (err) {
|
||||
|
@ -598,6 +598,24 @@ define(function(require) {
|
||||
});
|
||||
|
||||
describe('IMAP: list messages from local storage', function() {
|
||||
it('should fail for empty public key', function(done) {
|
||||
dummyMail.body = app.string.cryptPrefix + btoa('asdf') + app.string.cryptSuffix;
|
||||
devicestorageStub.listItems.yields(null, [dummyMail]);
|
||||
keychainStub.getReceiverPublicKey.yields();
|
||||
|
||||
emailDao.listMessages({
|
||||
folder: 'INBOX',
|
||||
offset: 0,
|
||||
num: 1
|
||||
}, function(err, emails) {
|
||||
expect(err).to.exist;
|
||||
expect(emails).to.not.exist;
|
||||
expect(devicestorageStub.listItems.calledOnce).to.be.true;
|
||||
expect(keychainStub.getReceiverPublicKey.calledOnce).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should work', function(done) {
|
||||
dummyMail.body = app.string.cryptPrefix + btoa('asdf') + app.string.cryptSuffix;
|
||||
devicestorageStub.listItems.yields(null, [dummyMail]);
|
||||
|
Loading…
Reference in New Issue
Block a user