Ticket #18412: 18412.2.diff
File 18412.2.diff, 1.5 KB (added by , 11 years ago) |
---|
-
wp-includes/post.php
4196 4196 if ( empty($url) ) //If any of the above options failed, Fallback on the GUID as used pre-2.7, not recommended to rely upon this. 4197 4197 $url = get_the_guid( $post->ID ); 4198 4198 4199 $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );4199 $url = apply_filters( 'wp_get_attachment_url', wp_double_encode_url( $url ), $post->ID ); 4200 4200 4201 4201 if ( empty( $url ) ) 4202 4202 return false; … … 4205 4205 } 4206 4206 4207 4207 /** 4208 * Double encode any accidental %xx combinations in the filename (e.g. My%20Picture.jpg) 4209 * 4210 * @since 3.7 4211 * @param string $url 4212 * 4213 * @return string 4214 */ 4215 function wp_double_encode_url( $url ) { 4216 return preg_replace( '/%\d\d/e', "rawurlencode(rawurlencode(urldecode('$0')))", $url ); 4217 } 4218 /** 4208 4219 * Retrieve thumbnail for an attachment. 4209 4220 * 4210 4221 * @since 2.1.0 -
wp-includes/media.php
174 174 // we have the actual image size, but might need to further constrain it if content_width is narrower 175 175 list( $width, $height ) = image_constrain_size_for_editor( $width, $height, $size ); 176 176 177 return array( $img_url, $width, $height, $is_intermediate );177 return array( wp_double_encode_url( $img_url ), $width, $height, $is_intermediate ); 178 178 } 179 179 return false; 180 180