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

Built from https://develop.svn.wordpress.org/trunk@49012


git-svn-id: http://core.svn.wordpress.org/trunk@48774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2020-09-20 13:15:04 +00:00
parent 123806ff28
commit ecfff6fe80
3 changed files with 5 additions and 5 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">

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-alpha-49011';
$wp_version = '5.6-alpha-49012';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.