Make WordPress Core

Ticket #36822: 36822.diff

File 36822.diff, 947 bytes (added by joemcgill, 10 years ago)

Match full file paths of image src attributes

  • src/wp-includes/media.php

    diff --git src/wp-includes/media.php src/wp-includes/media.php
    index 9f35f79..8d23f93 100644
    function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac 
    10351035                $image_baseurl = set_url_scheme( $image_baseurl, 'https' );
    10361036        }
    10371037
     1038        $image_basepath = parse_url( $image_baseurl, PHP_URL_PATH );
     1039
    10381040        /*
    10391041         * Images that have been edited in WordPress after being uploaded will
    10401042         * contain a unique hash. Look for that hash and use it later to filter
    function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac 
    10751077                }
    10761078
    10771079                // If the file name is part of the `src`, we've confirmed a match.
    1078                 if ( ! $src_matched && false !== strpos( $image_src, $dirname . $image['file'] ) ) {
     1080                if ( ! $src_matched && false !== strpos( $image_src, $image_basepath . $image['file'] ) ) {
    10791081                        $src_matched = $is_src = true;
    10801082                }
    10811083