File tree Expand file tree Collapse file tree
lhc_web/design/defaulttheme/widget/react-app/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -386,7 +386,9 @@ class ChatMessage extends PureComponent {
386386 if ( this . props . embedMode && this . props . embedMode == 'widget' && this . props . targetSame && cloneAttr . target && cloneAttr . target == '_blank' && domNode . attribs . href ) {
387387 const href = domNode . attribs . href ;
388388 const parentHost = window . parent . location . host ;
389- const isSameHost = href . startsWith ( `http://${ parentHost } ` ) || href . startsWith ( `https://${ parentHost } ` ) ;
389+ const isSameHost = href . startsWith ( `http://${ parentHost } ` )
390+ || href . startsWith ( `https://${ parentHost } ` )
391+ || helperFunctions . isRelativeURI ( href ) ;
390392 if ( isSameHost ) {
391393 if ( domNode . attribs . style ) {
392394 domNode . attribs . style = this . getStyleObjectFromString ( domNode . attribs . style ) ;
Original file line number Diff line number Diff line change @@ -179,6 +179,12 @@ class _helperFunctions {
179179 }
180180 }
181181
182+ isRelativeURI ( uri ) {
183+ if ( uri . startsWith ( '//' ) ) return false ;
184+ try { new URL ( uri ) ; return false ; }
185+ catch { return true ; }
186+ }
187+
182188 logJSError ( params ) {
183189 var e ;
184190 e = { } ;
@@ -196,4 +202,4 @@ class _helperFunctions {
196202
197203const helperFunctions = new _helperFunctions ( ) ;
198204window . lhcHelperfunctions = helperFunctions ;
199- export { helperFunctions } ;
205+ export { helperFunctions } ;
You can’t perform that action at this time.
0 commit comments