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:
@@ -109,12 +109,10 @@ module.exports = React.createClass({
|
||||
var content = this.props.mxEvent.getContent();
|
||||
var self = this;
|
||||
if (content.file !== undefined && this.state.decryptedUrl === null) {
|
||||
DecryptFile.decryptFile(content.file).then(function(blob) {
|
||||
if (!self._unmounted) {
|
||||
self.setState({
|
||||
decryptedUrl: window.URL.createObjectURL(blob),
|
||||
});
|
||||
}
|
||||
DecryptFile.decryptFile(content.file).then(function(url) {
|
||||
self.setState({
|
||||
decryptedUrl: url,
|
||||
});
|
||||
}).catch(function (err) {
|
||||
console.warn("Unable to decrypt attachment: ", err)
|
||||
// Set a placeholder image when we can't decrypt the image.
|
||||
@@ -125,10 +123,6 @@ module.exports = React.createClass({
|
||||
|
||||
componentWillUnmount: function() {
|
||||
dis.unregister(this.dispatcherRef);
|
||||
this._unmounted = true;
|
||||
if (this.state.decryptedUrl) {
|
||||
window.URL.revokeObjectURL(this.state.decryptedUrl);
|
||||
}
|
||||
},
|
||||
|
||||
onAction: function(payload) {
|
||||
|
||||
Reference in New Issue
Block a user