Media: Correct the image thumbnail logic in media templates.

This ensures the correct data properties are checked before displaying image thumbnails.

Props chetan200891

Fixes #49655


git-svn-id: https://develop.svn.wordpress.org/trunk@49012 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2020-09-20 13:13:46 +00:00
parent 74688add2c
commit 9462c458ff
2 changed files with 4 additions and 4 deletions

View File

@ -536,7 +536,7 @@ function wp_print_media_templates() {
<div class="thumbnail">
<# if ( data.uploading ) { #>
<div class="media-progress-bar"><div style="width: {{ data.percent }}%"></div></div>
<# } else if ( 'image' === data.type && data.sizes ) { #>
<# } else if ( 'image' === data.type && data.size && data.size.url ) { #>
<div class="centered">
<img src="{{ data.size.url }}" draggable="false" alt="" />
</div>
@ -598,7 +598,7 @@ function wp_print_media_templates() {
<div class="thumbnail thumbnail-{{ data.type }}">
<# if ( data.uploading ) { #>
<div class="media-progress-bar"><div></div></div>
<# } else if ( 'image' === data.type && data.sizes ) { #>
<# } else if ( 'image' === data.type && data.size && data.size.url ) { #>
<img src="{{ data.size.url }}" draggable="false" alt="" />
<# } else { #>
<img src="{{ data.icon }}" class="icon" draggable="false" alt="" />

View File

@ -2406,8 +2406,8 @@ function gallery_shortcode( $attr ) {
function wp_underscore_playlist_templates() {
?>
<script type="text/html" id="tmpl-wp-playlist-current-item">
<# if ( data.image ) { #>
<img src="{{ data.thumb.src }}" alt="" />
<# if ( data.thumb && data.thumb.src ) { #>
<img src="{{ data.thumb.src }}" alt="" />
<# } #>
<div class="wp-playlist-caption">
<span class="wp-playlist-item-meta wp-playlist-item-title">