Skip to content

Commit fe2887b

Browse files
committed
unfiltered_upload fix from Nazgul. fixes WordPress#4136
git-svn-id: https://develop.svn.wordpress.org/trunk@5353 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 1eb7a5f commit fe2887b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

wp-admin/admin-functions.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,13 +1948,16 @@ function wp_handle_upload_error( &$file, $message ) {
19481948
return $upload_error_handler( $file, __( 'Specified file failed upload test.' ));
19491949

19501950
// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
1951-
if ( $test_type && !current_user_can( 'unfiltered_upload' ) ) {
1951+
if ( $test_type ) {
19521952
$wp_filetype = wp_check_filetype( $file['name'], $mimes );
19531953

19541954
extract( $wp_filetype );
19551955

1956-
if ( !$type || !$ext )
1956+
if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
19571957
return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
1958+
1959+
if ( !$ext )
1960+
$ext = strrchr($file['name'], '.');
19581961
}
19591962

19601963
// A writable uploads dir will pass this test. Again, there's no point overriding this one.

0 commit comments

Comments
 (0)