Make WordPress Core

Ticket #16191: handle urlencoded characters.diff

File handle urlencoded characters.diff, 960 bytes (added by simonwheatley, 14 years ago)

URLDecode characters before saving to WP meta data

  • wp-admin/includes/file.php

     
    271271                }
    272272        }
    273273
     274        // Ensure the filename on the filesystem matches the filename we record in WP
     275        $file[ 'name' ] = urldecode( $file[ 'name' ] );
     276
    274277        $file = apply_filters( 'wp_handle_upload_prefilter', $file );
    275278
    276279        // You may define your own function and pass the name in $overrides['upload_error_handler']
  • wp-admin/includes/media.php

     
    196196                        $time = $post->post_date;
    197197        }
    198198
    199         $name = $_FILES[$file_id]['name'];
     199        $name = urldecode( $_FILES[$file_id]['name'] );
    200200        $file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
    201201
    202202        if ( isset($file['error']) )