WordPress.org

Make WordPress Core

Ticket #36549: 36549.3.diff

File 36549.3.diff, 1.1 KB (added by joemcgill, 5 years ago)
  • src/wp-includes/media.php

    diff --git src/wp-includes/media.php src/wp-includes/media.php
    index 9f35f79..ef42ca7 100644
    function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac 
    11421142         * @param array  $size_array    Array of width and height values in pixels (in that order).
    11431143         * @param string $image_src     The 'src' of the image.
    11441144         * @param array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
    1145          * @param int    $attachment_id Image attachment ID or 0.
     1145         * @param int    $attachment_id Image attachment ID or 0.
    11461146         */
    11471147        $sources = apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id );
    11481148
    function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac 
    11541154        $srcset = '';
    11551155
    11561156        foreach ( $sources as $source ) {
    1157                 $srcset .= $source['url'] . ' ' . $source['value'] . $source['descriptor'] . ', ';
     1157                $srcset .= str_replace( ' ', '%20', $source['url'] ) . ' ' . $source['value'] . $source['descriptor'] . ', ';
    11581158        }
    11591159
    11601160        return rtrim( $srcset, ', ' );