You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
Use data:// URI rather than blob: URI to avoid XSS
This commit is contained in:
@@ -88,21 +88,13 @@ module.exports = React.createClass({
|
||||
content.info.thumbnail_file
|
||||
);
|
||||
}
|
||||
thumbnailPromise.then(function(thumbnailBlob) {
|
||||
thumbnailPromise.then(function(thumbnailUrl) {
|
||||
DecryptFile.decryptFile(
|
||||
content.file
|
||||
).then(function(contentBlob) {
|
||||
if (self._unmounted) {
|
||||
return;
|
||||
}
|
||||
var contentUrl = window.URL.createObjectURL(contentBlob);
|
||||
var thumbUrl = null;
|
||||
if (thumbnailBlob) {
|
||||
thumbUrl = window.URL.createObjectURL(thumbnailBlob);
|
||||
}
|
||||
).then(function(contentUrl) {
|
||||
self.setState({
|
||||
decryptedUrl: contentUrl,
|
||||
decryptedThumbnailUrl: thumbUrl,
|
||||
decryptedThumbnailUrl: thumbnailUrl,
|
||||
});
|
||||
});
|
||||
}).catch(function (err) {
|
||||
@@ -113,17 +105,6 @@ module.exports = React.createClass({
|
||||
}
|
||||
},
|
||||
|
||||
componentWillUnmount: function() {
|
||||
this._unmounted = true;
|
||||
if (this.state.decryptedUrl) {
|
||||
window.URL.revokeObjectURL(this.state.decryptedUrl);
|
||||
}
|
||||
if (this.state.decryptedThumbnailUrl) {
|
||||
window.URL.revokeObjectURL(this.state.decryptedThumbnailUrl);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
render: function() {
|
||||
var content = this.props.mxEvent.getContent();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user