Make WordPress Core

Ticket #55274: 55274.3.diff

File 55274.3.diff, 1.0 KB (added by dravnic, 3 years ago)
  • src/wp-includes/media.php

    diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
    index 5ab3cd1913..cf40a22c61 100644
    a b function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac 
    13761376                if ( wp_image_matches_ratio( $image_width, $image_height, $image['width'], $image['height'] ) ) {
    13771377                        // Add the URL, descriptor, and value to the sources array to be returned.
    13781378                        $source = array(
    1379                                 'url'        => $image_baseurl . $image['file'],
     1379                                'url'        => $image_baseurl . rawurlencode( $image['file'] ),
    13801380                                'descriptor' => 'w',
    13811381                                'value'      => $image['width'],
    13821382                        );
    function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac 
    14261426        $srcset = '';
    14271427
    14281428        foreach ( $sources as $source ) {
    1429                 $srcset .= str_replace( ' ', '%20', $source['url'] ) . ' ' . $source['value'] . $source['descriptor'] . ', ';
     1429                $srcset .= $source['url'] . ' ' . $source['value'] . $source['descriptor'] . ', ';
    14301430        }
    14311431
    14321432        return rtrim( $srcset, ', ' );