From 83958ae7ea2113ad95a5becedf1e2cdaecd16ff2 Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Mon, 11 Feb 2019 23:24:24 +0000 Subject: [PATCH] Check if thumbnail_url is set in getPhotoHtml 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 5161d13523c6b6..085ea4b22ff8c8 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 ); };