1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-08 21:42:24 +03:00

Check for sound before logging it

Co-Authored-By: Half-Shot <will@half-shot.uk>
This commit is contained in:
Katie Wolfe
2019-04-21 12:35:59 +01:00
committed by GitHub
parent 776210c135
commit b11050d327

View File

@@ -122,7 +122,7 @@ const Notifier = {
_playAudioNotification: function(ev, room) { _playAudioNotification: function(ev, room) {
this.getSoundForRoom(room.roomId).then((sound) => { this.getSoundForRoom(room.roomId).then((sound) => {
console.log(`Got sound ${sound.name || "default"} for ${room.roomId}`); console.log(`Got sound ${sound && sound.name ? sound.name : "default"} for ${room.roomId}`);
// XXX: How do we ensure this is a sound file and not // XXX: How do we ensure this is a sound file and not
// going to be exploited? // going to be exploited?
const selector = document.querySelector(sound ? `audio[src='${sound.url}']` : "#messageAudio"); const selector = document.querySelector(sound ? `audio[src='${sound.url}']` : "#messageAudio");