diff --git a/src/skins/vector/views/molecules/MFileTile.js b/src/skins/vector/views/molecules/MFileTile.js index f7e8991f93..9180bd6b83 100644 --- a/src/skins/vector/views/molecules/MFileTile.js +++ b/src/skins/vector/views/molecules/MFileTile.js @@ -30,15 +30,25 @@ module.exports = React.createClass({ var content = this.props.mxEvent.getContent(); var cli = MatrixClientPeg.get(); - return ( - -
- - - Download {this.presentableTextForFile(content)} - -
+ var httpUrl = cli.mxcUrlToHttp(content.url); + var text = this.presentableTextForFile(content); + + if (httpUrl) { + return ( + +
+ + + Download {text} + +
+
+ ); + } else { + var extra = text ? ': '+text : ''; + return + Invalid file{extra} - ); + } }, }); diff --git a/src/skins/vector/views/molecules/MImageTile.js b/src/skins/vector/views/molecules/MImageTile.js index 0667dabd10..2f3b7a55db 100644 --- a/src/skins/vector/views/molecules/MImageTile.js +++ b/src/skins/vector/views/molecules/MImageTile.js @@ -73,18 +73,33 @@ module.exports = React.createClass({ var imgStyle = {}; if (thumbHeight) imgStyle['height'] = thumbHeight; - return ( - - - {content.body} - -
- - - Download {content.body} ({ content.info && content.info.size ? filesize(content.info.size) : "Unknown size" }) + var thumbUrl = cli.mxcUrlToHttp(content.url, 480, 360); + if (thumbUrl) { + return ( + + + {content.body} -
-
- ); +
+ + + Download {content.body} ({ content.info && content.info.size ? filesize(content.info.size) : "Unknown size" }) + +
+
+ ); + } else if (content.body) { + return ( + + Image '{content.body}' cannot be displayed. + + ); + } else { + return ( + + This image cannot be displayed. + + ); + } }, });