Use data:// URI rather than blob: URI to avoid XSS
This commit is contained in:
parent
6ea0085290
commit
8f778f54fd
5 changed files with 37 additions and 59 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue