WordPress.org

Make WordPress Core

Ticket #6073: wp_upload_dir_bug-r7133.patch

File wp_upload_dir_bug-r7133.patch, 1.0 KB (added by tellyworth, 10 years ago)
  • wordpress/wp-includes/functions.php

     
    10631063// Returns an array containing the current upload directory's path and url, or an error message.
    10641064function wp_upload_dir( $time = NULL ) {
    10651065        $siteurl = get_option( 'siteurl' );
    1066         $upload_path = $dir = get_option( 'upload_path' );
     1066        $upload_path = get_option( 'upload_path' );
     1067        if ( trim($upload_path) === '' )
     1068                $upload_path = 'wp-content/uploads';
     1069        $dir = $upload_path;
    10671070
    10681071        // $dir is absolute, $path is (maybe) relative to ABSPATH
    10691072        $dir = path_join( ABSPATH, $upload_path );
     
    10721075        if ( !$url = get_option( 'upload_url_path' ) )
    10731076                $url = trailingslashit( $siteurl ) . $path;
    10741077
    1075         if ( $dir == ABSPATH ) // the option was empty
    1076                 $dir = ABSPATH . 'wp-content/uploads';
    1077 
    10781078        if ( defined('UPLOADS') ) {
    10791079                $dir = ABSPATH . UPLOADS;
    10801080                $url = trailingslashit( $siteurl ) . UPLOADS;