From f47ebf8582928cfbba6dee2cba25f53718dfeede Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 30 Apr 2007 15:54:50 +0000 Subject: [PATCH] unfiltered_upload fix from Nazgul. fixes #4136 git-svn-id: http://svn.automattic.com/wordpress/trunk@5353 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-functions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index cbed44e70..d7e61f38b 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -1948,13 +1948,16 @@ function wp_handle_upload( &$file, $overrides = false ) { return $upload_error_handler( $file, __( 'Specified file failed upload test.' )); // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter. - if ( $test_type && !current_user_can( 'unfiltered_upload' ) ) { + if ( $test_type ) { $wp_filetype = wp_check_filetype( $file['name'], $mimes ); extract( $wp_filetype ); - if ( !$type || !$ext ) + if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) ) return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' )); + + if ( !$ext ) + $ext = strrchr($file['name'], '.'); } // A writable uploads dir will pass this test. Again, there's no point overriding this one.