Commit fa84bd71 authored by Martin Kraft's avatar Martin Kraft Committed by cpanato

MM-13723: Guard against null imagesMetadata. (#2266)

parent cb13e552
...@@ -365,7 +365,7 @@ class LoginController extends React.Component { ...@@ -365,7 +365,7 @@ class LoginController extends React.Component {
src={Client4.getBrandImageUrl(0)} src={Client4.getBrandImageUrl(0)}
/> />
<div> <div>
{messageHtmlToComponent(formattedText, false, {mentions: false})} {messageHtmlToComponent(formattedText, false, {mentions: false, imagesMetadata: null})}
</div> </div>
</div> </div>
); );
......
...@@ -17,6 +17,7 @@ import PostEmoji from 'components/post_emoji'; ...@@ -17,6 +17,7 @@ import PostEmoji from 'components/post_emoji';
* - images - If specified, markdown images are replaced with the MarkdownImage component. Defaults to true. * - images - If specified, markdown images are replaced with the MarkdownImage component. Defaults to true.
* - imageProps - If specified, any extra props that should be passed into the MarkdownImage component. * - imageProps - If specified, any extra props that should be passed into the MarkdownImage component.
* - latex - If specified, latex is replaced with the LatexBlock component. Defaults to true. * - latex - If specified, latex is replaced with the LatexBlock component. Defaults to true.
* - imagesMetadata - the dimensions of the image as retrieved from post.metadata.images.
*/ */
export function messageHtmlToComponent(html, isRHS, options = {}) { export function messageHtmlToComponent(html, isRHS, options = {}) {
if (!html) { if (!html) {
...@@ -81,7 +82,7 @@ export function messageHtmlToComponent(html, isRHS, options = {}) { ...@@ -81,7 +82,7 @@ export function messageHtmlToComponent(html, isRHS, options = {}) {
const callMarkdownImage = ( const callMarkdownImage = (
<MarkdownImage <MarkdownImage
className={className} className={className}
dimensions={options.imagesMetadata[attribs.src]} dimensions={options.imagesMetadata && options.imagesMetadata[attribs.src]}
{...attribs} {...attribs}
{...options.imageProps} {...options.imageProps}
/> />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment