1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-26 02:42:17 -05:00

remove pgp signature from attachments

This commit is contained in:
Felix Hammerl 2014-02-07 09:23:38 +01:00
parent 0c2fd7f052
commit f22c57b750
2 changed files with 49 additions and 9 deletions

View File

@ -843,7 +843,18 @@ define(function(require) {
self._imapParseMessageBlock({
message: email,
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);
});
});
});

View File

@ -881,6 +881,17 @@ define(function(require) {
}];
dummyDecryptedMail.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({
folder: folder
@ -919,7 +930,9 @@ define(function(require) {
}
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(keychainStub.getReceiverPublicKey.calledOnce).to.be.true;
expect(pgpStub.decrypt.calledOnce).to.be.true;
@ -1446,6 +1459,18 @@ define(function(require) {
path: folder,
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({
folder: folder
@ -1490,7 +1515,9 @@ define(function(require) {
}
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(imapSearchStub.calledThrice).to.be.true;
expect(imapGetStub.calledOnce).to.be.true;
@ -2671,7 +2698,9 @@ define(function(require) {
pgpStub.exportKeys.yields(null, {
publicKeyArmored: key
});
pgpStub.decrypt.yields({errMsg: errMsg});
pgpStub.decrypt.yields({
errMsg: errMsg
});
dao.listForOutbox(function(err, mails) {
expect(err).to.not.exist;