Include the mimetype with the file info. Store the objectURL in state so that it can be used normally by the exising templates

Conflicts:
	src/ContentMessages.js
	src/components/views/messages/MImageBody.js
This commit is contained in:
Mark Haines 2016-11-04 11:52:47 +00:00
parent 23e764604c
commit 49b3aec1e2
2 changed files with 91 additions and 7 deletions

View file

@ -149,7 +149,19 @@ class ContentMessages {
dis.dispatch({action: 'upload_progress', upload: upload});
}
}).then(function(url) {
content.url = url;
if (encryptInfo === null) {
// If the attachment isn't encrypted then include the URL directly.
content.url = url;
} else {
// If the attachment is encrypted then bundle the URL along
// with the information needed to decrypt the attachment and
// add it under a file key.
encryptInfo.url = url;
if (file.type) {
encryptInfo.mimetype = file.type;
}
content.file = encryptInfo;
}
return matrixClient.sendMessage(roomId, content);
}, function(err) {
error = err;