mirror of
https://github.com/moparisthebest/mail
synced 2024-12-01 13:22:16 -05:00
remove pgp signature from attachments
This commit is contained in:
parent
0c2fd7f052
commit
f22c57b750
@ -843,7 +843,18 @@ define(function(require) {
|
|||||||
self._imapParseMessageBlock({
|
self._imapParseMessageBlock({
|
||||||
message: email,
|
message: email,
|
||||||
block: decrypted
|
block: decrypted
|
||||||
}, localCallback);
|
}, function(error, parsedMessage) {
|
||||||
|
if (!parsedMessage) {
|
||||||
|
localCallback(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the pgp-signature from the attachments
|
||||||
|
parsedMessage.attachments = _.reject(parsedMessage.attachments, function(attmt) {
|
||||||
|
return attmt.mimeType === "application/pgp-signature";
|
||||||
|
});
|
||||||
|
localCallback(error, parsedMessage);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -881,6 +881,17 @@ define(function(require) {
|
|||||||
}];
|
}];
|
||||||
dummyDecryptedMail.unread = true;
|
dummyDecryptedMail.unread = true;
|
||||||
dummyEncryptedMail.unread = true;
|
dummyEncryptedMail.unread = true;
|
||||||
|
dummyDecryptedMail.attachments = [{
|
||||||
|
filename: 'filename',
|
||||||
|
filesize: 123,
|
||||||
|
mimeType: 'text/plain',
|
||||||
|
content: null
|
||||||
|
}, {
|
||||||
|
filename: 'filename',
|
||||||
|
filesize: 123,
|
||||||
|
mimeType: "application/pgp-signature",
|
||||||
|
content: null
|
||||||
|
}];
|
||||||
|
|
||||||
localListStub = sinon.stub(dao, '_localListMessages').withArgs({
|
localListStub = sinon.stub(dao, '_localListMessages').withArgs({
|
||||||
folder: folder
|
folder: folder
|
||||||
@ -919,7 +930,9 @@ define(function(require) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect(dao._account.busy).to.be.false;
|
expect(dao._account.busy).to.be.false;
|
||||||
expect(dao._account.folders[0].messages).to.not.be.empty;
|
expect(dao._account.folders[0].messages.length).to.equal(1);
|
||||||
|
expect(dao._account.folders[0].messages[0]).to.equal(dummyDecryptedMail);
|
||||||
|
expect(dao._account.folders[0].messages[0].attachments.length).to.equal(1);
|
||||||
expect(localListStub.calledOnce).to.be.true;
|
expect(localListStub.calledOnce).to.be.true;
|
||||||
expect(keychainStub.getReceiverPublicKey.calledOnce).to.be.true;
|
expect(keychainStub.getReceiverPublicKey.calledOnce).to.be.true;
|
||||||
expect(pgpStub.decrypt.calledOnce).to.be.true;
|
expect(pgpStub.decrypt.calledOnce).to.be.true;
|
||||||
@ -1446,6 +1459,18 @@ define(function(require) {
|
|||||||
path: folder,
|
path: folder,
|
||||||
messages: []
|
messages: []
|
||||||
}];
|
}];
|
||||||
|
dummyDecryptedMail.attachments = [{
|
||||||
|
filename: 'filename',
|
||||||
|
filesize: 123,
|
||||||
|
mimeType: 'text/plain',
|
||||||
|
content: null
|
||||||
|
}, {
|
||||||
|
filename: 'filename',
|
||||||
|
filesize: 123,
|
||||||
|
mimeType: "application/pgp-signature",
|
||||||
|
content: null
|
||||||
|
}];
|
||||||
|
|
||||||
|
|
||||||
localListStub = sinon.stub(dao, '_localListMessages').withArgs({
|
localListStub = sinon.stub(dao, '_localListMessages').withArgs({
|
||||||
folder: folder
|
folder: folder
|
||||||
@ -1490,7 +1515,9 @@ define(function(require) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect(dao._account.busy).to.be.false;
|
expect(dao._account.busy).to.be.false;
|
||||||
expect(dao._account.folders[0].messages).to.not.be.empty;
|
expect(dao._account.folders[0].messages.length).to.equal(1);
|
||||||
|
expect(dao._account.folders[0].messages[0]).to.equal(dummyDecryptedMail);
|
||||||
|
expect(dao._account.folders[0].messages[0].attachments.length).to.equal(1);
|
||||||
expect(localListStub.calledOnce).to.be.true;
|
expect(localListStub.calledOnce).to.be.true;
|
||||||
expect(imapSearchStub.calledThrice).to.be.true;
|
expect(imapSearchStub.calledThrice).to.be.true;
|
||||||
expect(imapGetStub.calledOnce).to.be.true;
|
expect(imapGetStub.calledOnce).to.be.true;
|
||||||
@ -2671,7 +2698,9 @@ define(function(require) {
|
|||||||
pgpStub.exportKeys.yields(null, {
|
pgpStub.exportKeys.yields(null, {
|
||||||
publicKeyArmored: key
|
publicKeyArmored: key
|
||||||
});
|
});
|
||||||
pgpStub.decrypt.yields({errMsg: errMsg});
|
pgpStub.decrypt.yields({
|
||||||
|
errMsg: errMsg
|
||||||
|
});
|
||||||
|
|
||||||
dao.listForOutbox(function(err, mails) {
|
dao.listForOutbox(function(err, mails) {
|
||||||
expect(err).to.not.exist;
|
expect(err).to.not.exist;
|
||||||
|
Loading…
Reference in New Issue
Block a user