Ticket #18412: 18412.diff
File 18412.diff, 1.5 KB (added by , 13 years ago) |
---|
-
wp-includes/post.php
3913 3913 if ( empty($url) ) //If any of the above options failed, Fallback on the GUID as used pre-2.7, not recomended to rely upon this. 3914 3914 $url = get_the_guid( $post->ID ); 3915 3915 3916 $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );3916 $url = apply_filters( 'wp_get_attachment_url', wp_double_encode_url($url), $post->ID ); 3917 3917 3918 3918 if ( 'attachment' != $post->post_type || empty( $url ) ) 3919 3919 return false; … … 3922 3922 } 3923 3923 3924 3924 /** 3925 * Double encode any accidental %XX combinations in the filename (e.g. "My%20Picture.jpg") 3926 * @param string $url 3927 * @return string 3928 */ 3929 function wp_double_encode_url($url) { 3930 return preg_replace('/%\d\d/e', "rawurlencode(rawurlencode(urldecode('$0')))", $url); 3931 } 3932 3933 /** 3925 3934 * Retrieve thumbnail for an attachment. 3926 3935 * 3927 3936 * @since 2.1.0 -
wp-includes/media.php
169 169 // we have the actual image size, but might need to further constrain it if content_width is narrower 170 170 list( $width, $height ) = image_constrain_size_for_editor( $width, $height, $size ); 171 171 172 return array( $img_url, $width, $height, $is_intermediate );172 return array( wp_double_encode_url($img_url), $width, $height, $is_intermediate ); 173 173 } 174 174 return false; 175 175