Handle decryption errors
parent
e0cea74c7e
commit
e949d91162
|
@ -92,9 +92,14 @@ module.exports = React.createClass({
|
||||||
this.dispatcherRef = dis.register(this.onAction);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
this.fixupHeight();
|
this.fixupHeight();
|
||||||
var content = this.props.mxEvent.getContent();
|
var content = this.props.mxEvent.getContent();
|
||||||
|
var self = this;
|
||||||
if (content.file !== undefined) {
|
if (content.file !== undefined) {
|
||||||
// TODO: hook up an error handler to the promise.
|
// TODO: hook up an error handler to the promise.
|
||||||
this.decryptFile(content.file);
|
this.decryptFile(content.file).catch(function (err) {
|
||||||
|
console.warn("Unable to decrypt attachment: ", err)
|
||||||
|
// Set a placeholder image when we can't decrypt the image.
|
||||||
|
self.refs.image.src = "img/warning.svg";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -184,9 +189,10 @@ module.exports = React.createClass({
|
||||||
if (content.file !== undefined) {
|
if (content.file !== undefined) {
|
||||||
// Need to decrypt the attachment
|
// Need to decrypt the attachment
|
||||||
// The attachment is decrypted in componentDidMount.
|
// The attachment is decrypted in componentDidMount.
|
||||||
|
// For now add an img tag with a spinner.
|
||||||
return (
|
return (
|
||||||
<span className="mx_MImageBody" ref="body">
|
<span className="mx_MImageBody" ref="body">
|
||||||
<img className="mx_MImageBody_thumbnail" src="img/encrypted-placeholder.svg" ref="image"
|
<img className="mx_MImageBody_thumbnail" src="img/spinner.gif" ref="image"
|
||||||
alt={content.body} />
|
alt={content.body} />
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue