Ticket #2166: 2166.diff

File 2166.diff, 2.2 KB (added by davidhouse, 6 years ago)
  • wp-admin/inline-uploading.php

     
    8686 
    8787                if ( @file_exists($thumb) ) { 
    8888                        $newdata = $imagedata; 
    89                         $newdata['thumb'] = basename($thumb); 
     89                        $newdata['thumb'] = rawurlencode(basename($thumb)); 
    9090                        update_post_meta($id, '_wp_attachment_metadata', $newdata, $imagedata); 
    9191                } else { 
    9292                        $error = $thumb; 
     
    215215                $uwidth_sum += 128; 
    216216                if ( preg_match('!^image/!', $attachment['post_mime_type'] ) ) { 
    217217                        $image = & $attachment; 
    218                         if ( ($image['width'] > 128 || $image['height'] > 96) && !empty($image['thumb']) && file_exists(dirname($image['file']).'/'.$image['thumb']) ) { 
     218                        if ( ($image['width'] > 128 || $image['height'] > 96) && !empty($image['thumb']) && file_exists(dirname($image['file']).'/'.rawurldecode($image['thumb'])) ) { 
    219219                                $src = str_replace(basename($image['guid']), $image['thumb'], $image['guid']); 
    220220                                $script .= "srca[{$ID}] = '$src'; 
    221221srcb[{$ID}] = '{$image['guid']}'; 
  • wp-admin/admin-functions.php

     
    743743                        @ imagecopyresampled($thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1]); 
    744744 
    745745                        // If no filters change the filename, we'll do a default transformation. 
    746                         if ( basename($file) == $thumb = apply_filters('thumbnail_filename', basename($file)) ) 
     746                        $thumb = apply_filters('thumbnail_filename', basename($file)); 
     747                        if ( basename($file) == $thumb) 
    747748                                $thumb = preg_replace('!(\.[^.]+)?$!', __('.thumbnail').'$1', basename($file), 1); 
    748749 
    749750                        $thumbpath = str_replace(basename($file), $thumb, $file); 
     
    764765                                        $error = __("Thumbnail path invalid"); 
    765766                                } 
    766767                        } 
    767  
    768768                } 
    769769        } else { 
    770770                $error = __('File not found'); 
     
    17731773        @ chmod($new_file, $perms); 
    17741774 
    17751775        // Compute the URL 
    1776         $url = $uploads['url'] . "/$filename"; 
     1776        $url = $uploads['url'] . "/" . rawurlencode($filename); 
    17771777 
    17781778        return array('file' => $new_file, 'url' => $url, 'type' => $type); 
    17791779}