Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(reactions,polls,subtitles): handle unexpected field types in endpoint messages
damencho64c7a8a3b5ef
diff --git a/react/features/chat/middleware.ts b/react/features/chat/middleware.tsindex 6fa0173014..b6c0c40c39 100644--- a/react/features/chat/middleware.ts+++ b/react/features/chat/middleware.ts@@ -151,7 +151,7 @@ MiddlewareRegistry.register(store => next => action => {if (data?.name === ENDPOINT_REACTION_NAME) {// Only accept known reaction keys, skip duplicates and keep just 3.- const reactions = Array.from(new Set(data.reactions))+ const reactions = Array.from(new Set(Array.isArray(data.reactions) ? data.reactions : [])).filter((reaction): reaction is string => typeof reaction === 'string' && reaction in REACTIONS).slice(0, 3);diff --git a/react/features/polls/middleware.ts b/react/features/polls/middleware.tsindex e5943f28ca..2c95c1c878 100644--- a/react/features/polls/middleware.ts+++ b/react/features/polls/middleware.ts@@ -143,7 +143,7 @@ function _handleReceivedPollsAnswer(data: any, dispatch: IStore['dispatch'], getconst { pollId, answers, senderId, senderName } = data;const receivedAnswer: IIncomingAnswerData = {- answers: answers.slice(0, MAX_ANSWERS).map(Boolean),+ answers: Array.isArray(answers) ? answers.slice(0, MAX_ANSWERS).map(Boolean) : [],pollId,senderId,voterName: getParticipantById(getState(), senderId)diff --git a/react/features/subtitles/middleware.ts b/react/features/subtitles/middleware.tsindex 2a0540e539..7c854d9f6d 100644--- a/react/features/subtitles/middleware.ts+++ b/react/features/subtitles/middleware.ts@@ -148,7 +148,7 @@ function _endpointMessageReceived(store: IStore, next: Function, action: AnyActiconst state = getState();const _areClosedCaptionsEnabled = areClosedCaptionsEnabled(store.getState());const transcriptMessageID = json.message_id;- const { name, id, avatar_url: avatarUrl } = json.participant;+ const { name, id, avatar_url: avatarUrl } = json.participant ?? {};const participant = {avatarUrl,id,@@ -219,6 +219,9 @@ function _endpointMessageReceived(store: IStore, next: Function, action: AnyActi// Displays interim and final results without any translation if// translations are disabled.+ if (!Array.isArray(json.transcript) || !json.transcript[0]) {+ return next(action);+ }const { text } = json.transcript[0];const displayText = `${detailsPrefix}${text}`;