Make WordPress Core

Ticket #22796: 22796.diff

File 22796.diff, 830 bytes (added by koopersmith, 12 years ago)
  • wp-includes/js/media-views.js

     
    787787                scanImage: function( attributes ) {
    788788                        var frame = this.frame,
    789789                                state = this,
    790                                 url = this.props.get('url'),
     790                                url = this.props.get('url') || '',
    791791                                image = new Image();
    792792
    793793                        // Try to load the image and find its width/height.
     
    805805                        image.src = url;
    806806
    807807                        // Check if the URL looks like an image; skew toward success.
    808                         url = url.replace( /([?|#].*)$/, '' );
    809                         if ( /\.(png|jpe?g|gif)$/i.test( url ) )
     808                        // Trims query parameters and hash components.
     809                        if ( /\.(png|jpe?g|gif)$/i.test( url.replace( /([?|#].*)$/, '' ) ) )
    810810                                attributes.type = 'image';
    811811                },
    812812