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
|
@ -49,12 +49,10 @@ export default class MAudioBody extends React.Component {
|
|||
componentDidMount() {
|
||||
var content = this.props.mxEvent.getContent();
|
||||
if (content.file !== undefined && this.state.decryptedUrl === null) {
|
||||
decryptFile(content.file).then((blob) => {
|
||||
if (!this._unmounted) {
|
||||
this.setState({
|
||||
decryptedUrl: window.URL.createObjectURL(blob),
|
||||
});
|
||||
}
|
||||
decryptFile(content.file).then((url) => {
|
||||
this.setState({
|
||||
decryptedUrl: url
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.warn("Unable to decrypt attachment: ", err)
|
||||
// Set a placeholder image when we can't decrypt the image.
|
||||
|
@ -63,13 +61,6 @@ export default class MAudioBody extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this._unmounted = true;
|
||||
if (this.state.decryptedUrl) {
|
||||
window.URL.revokeObjectURL(this.state.decryptedUrl);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
var content = this.props.mxEvent.getContent();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue