Make WordPress Core

Changeset 11198


Ignore:
Timestamp:
05/05/2009 05:57:56 AM (15 years ago)
Author:
ryan
Message:

Don't over sanitize uploaded file titles. Props hakre. fixes #9081

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/media.php

    r11190 r11198  
    190190    }
    191191
     192    $name = $_FILES[$file_id]['name'];
    192193    $file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
    193194
    194195    if ( isset($file['error']) )
    195196        return new WP_Error( 'upload_error', $file['error'] );
     197       
     198    $name_parts = pathinfo($name);
     199    $name = trim( substr( $name, 0, -(1 + strlen($name_parts['extension'])) ) );
    196200
    197201    $url = $file['url'];
    198202    $type = $file['type'];
    199203    $file = $file['file'];
    200     $title = preg_replace('/\.[^.]+$/', '', basename($file));
     204    $title = $name;
    201205    $content = '';
    202206
Note: See TracChangeset for help on using the changeset viewer.