Fix attachments

This commit is contained in:
Matt Corallo 2014-05-15 01:02:15 -04:00
parent 3103eaa192
commit 07a23f0759
3 changed files with 19 additions and 7 deletions

View file

@ -321,7 +321,7 @@ function storeMessage(messageObject) {
messageMap[messageObject.pushMessage.source] = conversation;
}
conversation[conversation.length] = { message: getString(messageObject.message.body),
conversation[conversation.length] = { message: messageObject.message.body != null && getString(messageObject.message.body),
sender: messageObject.pushMessage.source,
timestamp: messageObject.pushMessage.timestamp.div(dcodeIO.Long.fromNumber(1000)).toNumber() };
storage.putEncrypted("messageMap", messageMap);
@ -465,7 +465,7 @@ function subscribeToPush(message_callback) {
return crypto.handleIncomingPushMessageProto(proto).then(function(decrypted) {
var handleAttachment = function(attachment) {
return API.getAttachment(attachment.id).then(function(encryptedBin) {
return crypto.decryptAttachment(encryptedBin, attachment.key).then(function(decryptedBin) {
return crypto.decryptAttachment(encryptedBin, toArrayBuffer(attachment.key)).then(function(decryptedBin) {
attachment.decrypted = decryptedBin;
});
});