diff --git a/bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeeting.js b/bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeeting.js index 6ffdb31ca1d46529e6bc8f4b88fe1fa9f803d251..86321e7f7e331a1f1300eb00272cc8644880127e 100755 --- a/bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeeting.js +++ b/bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeeting.js @@ -3,6 +3,7 @@ import { check, Match, } from 'meteor/check'; +import SanitizeHTML from 'sanitize-html'; import Meetings, { RecordMeetings } from '/imports/api/meetings'; import Logger from '/imports/startup/server/logger'; import createNote from '/imports/api/note/server/methods/createNote'; @@ -104,11 +105,20 @@ export default function addMeeting(meeting) { const meetingEnded = false; - newMeeting.welcomeProp.welcomeMsg = newMeeting.welcomeProp.welcomeMsg.replace( + let { welcomeMsg } = newMeeting.welcomeProp; + const sanitizedText = SanitizeHTML(welcomeMsg, { + allowedTags: ['b', 'strong', 'i', 'u', 'a', 'br'], + allowedAttributes: { + a: ['href', 'name', 'target'], + }, + }); + welcomeMsg = sanitizedText.replace( 'href="event:', 'href="', ); + newMeeting.welcomeProp.welcomeMsg = welcomeMsg; + const insertBlankTarget = (s, i) => `${s.substr(0, i)} target="_blank"${s.substr(i)}`; const linkWithoutTarget = new RegExp('<a href="(.*?)">', 'g'); linkWithoutTarget.test(newMeeting.welcomeProp.welcomeMsg); diff --git a/bigbluebutton-html5/imports/ui/components/chat/message-list/message-list-item/message/component.jsx b/bigbluebutton-html5/imports/ui/components/chat/message-list/message-list-item/message/component.jsx index 11b255b2347f09b5dcc98677ef1337afb487743c..8d4626280bd4b6bea55ff88e834900f485acca22 100644 --- a/bigbluebutton-html5/imports/ui/components/chat/message-list/message-list-item/message/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/chat/message-list/message-list-item/message/component.jsx @@ -2,7 +2,6 @@ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import _ from 'lodash'; import fastdom from 'fastdom'; -import SanitizeHTML from 'sanitize-html'; const propTypes = { text: PropTypes.string.isRequired, @@ -152,17 +151,10 @@ export default class MessageListItem extends PureComponent { className, } = this.props; - const sanitizedText = SanitizeHTML(text, { - allowedTags: ['b', 'strong', 'i', 'u', 'a', 'br'], - allowedAttributes: { - a: ['href', 'name', 'target'], - }, - }); - return ( <p ref={(ref) => { this.text = ref; }} - dangerouslySetInnerHTML={{ __html: sanitizedText }} + dangerouslySetInnerHTML={{ __html: text }} className={className} /> );