From bee0424bcb4e8fc0a7285ac36f589ac13b1622c4 Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Tue, 12 Feb 2019 09:17:32 +0000 Subject: [PATCH] Check if thumbnail_url is set in getPhotoHtml (#13825) thumbnail_url is an optional field in oembed endpoints. Check it is set first before using and fallback to url if not. --- packages/block-library/src/embed/util.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/embed/util.js b/packages/block-library/src/embed/util.js index 5161d13523c6b..085ea4b22ff8c 100644 --- a/packages/block-library/src/embed/util.js +++ b/packages/block-library/src/embed/util.js @@ -51,8 +51,9 @@ export const isFromWordPress = ( html ) => { export const getPhotoHtml = ( photo ) => { // 100% width for the preview so it fits nicely into the document, some "thumbnails" are - // actually the full size photo. - const photoPreview =

{

; + // actually the full size photo. If thumbnails not found, use full image. + const imageUrl = ( photo.thumbnail_url ) ? photo.thumbnail_url : photo.url; + const photoPreview =

{

; return renderToString( photoPreview ); };