Ticket #4136: 4136fix.diff

File 4136fix.diff, 962 bytes (added by Nazgul, 6 years ago)
Line 
1Index: wp-admin/admin-functions.php
2===================================================================
3--- wp-admin/admin-functions.php        (revision 5346)
4+++ wp-admin/admin-functions.php        (working copy)
5@@ -1948,13 +1948,16 @@
6                return $upload_error_handler( $file, __( 'Specified file failed upload test.' ));
7 
8        // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
9-       if ( $test_type && !current_user_can( 'unfiltered_upload' ) ) {
10+       if ( $test_type ) {
11                $wp_filetype = wp_check_filetype( $file['name'], $mimes );
12 
13                extract( $wp_filetype );
14 
15-               if ( !$type || !$ext )
16+               if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
17                        return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
18+               
19+               if ( !$ext )
20+                       $ext = strrchr($file['name'], '.');
21        }
22 
23        // A writable uploads dir will pass this test. Again, there's no point overriding this one.