Make WordPress Core

Ticket #34945: 34945.diff

File 34945.diff, 1.9 KB (added by joemcgill, 9 years ago)
  • src/wp-includes/media.php

    diff --git src/wp-includes/media.php src/wp-includes/media.php
    index 7a41653..aec2e0e 100644
    function _wp_upload_dir_baseurl() { 
    917917
    918918        if ( empty( $baseurl[$blog_id] ) ) {
    919919                $uploads_dir = wp_upload_dir();
    920                 $baseurl[$blog_id] = $uploads_dir['baseurl'];
     920                $baseurl[$blog_id] = set_url_scheme( $uploads_dir['baseurl'] );
    921921        }
    922922
    923923        return $baseurl[$blog_id];
  • tests/phpunit/tests/media.php

    diff --git tests/phpunit/tests/media.php tests/phpunit/tests/media.php
    index 5fa4fab..214c597 100644
    EOF; 
    13021302                $actual     = wp_make_content_images_responsive( $unfiltered );
    13031303
    13041304                $this->assertSame( $expected, $actual );
     1305}
     1306
     1307        /**
     1308         * @ticket 34945
     1309         * @ticket 33641
     1310         */
     1311        function test_wp_get_attachment_image_with_https_on() {
     1312                // Save server data for cleanup
     1313                $is_ssl = is_ssl();
     1314
     1315                // Mock meta for the image.
     1316                $image_meta = array(
     1317                        'width' => 1200,
     1318                        'height' => 600,
     1319                        'file' => 'test.jpg',
     1320                        'sizes' => array(
     1321                                'thumbnail' => array(
     1322                                        'file' => 'test-150x150.jpg',
     1323                                        'width' => 150,
     1324                                        'height' => 150,
     1325                                ),
     1326                                'medium' => array(
     1327                                        'file' => 'test-300x150.jpg',
     1328                                        'width' => 300,
     1329                                        'height' => 150,
     1330                                ),
     1331                                'large' => array(
     1332                                        'file' => 'test-1024x512.jpg',
     1333                                        'width' => 1024,
     1334                                        'height' => 512,
     1335                                ),
     1336                        )
     1337                );
     1338
     1339                // Test using the large file size.
     1340                $size_array = array(1024, 512);
     1341                $image_url  = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['sizes']['large']['file'];
     1342
     1343                $_SERVER['HTTPS'] = 'on';
     1344
     1345                $expected = 'https://example.org/wp-content/uploads/test-300x150.jpg 300w, https://example.org/wp-content/uploads/test-1024x512.jpg 1024w, https://example.org/wp-content/uploads/test.jpg 1200w';
     1346
     1347                $this->assertSame( $expected, wp_calculate_image_srcset( $size_array, $image_url, $image_meta ) );
     1348
     1349                // Cleanup
     1350                $_SERVER['HTTPS'] = $is_ssl;
    13051351        }
    13061352}