From bf18e2fd3f8118e1dcc0d800e996df962b5b745a Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 3 Mar 2008 04:14:16 +0000 Subject: [PATCH] Deal correctly with empty upload_path option. Hat tip: tellyworth. git-svn-id: http://svn.automattic.com/wordpress/trunk@7134 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 661a79ffc..77392b0e7 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1063,7 +1063,10 @@ function path_join( $base, $path ) { // Returns an array containing the current upload directory's path and url, or an error message. function wp_upload_dir( $time = NULL ) { $siteurl = get_option( 'siteurl' ); - $upload_path = $dir = get_option( 'upload_path' ); + $upload_path = get_option( 'upload_path' ); + if ( trim($upload_path) === '' ) + $upload_path = 'wp-content/uploads'; + $dir = $upload_path; // $dir is absolute, $path is (maybe) relative to ABSPATH $dir = path_join( ABSPATH, $upload_path ); @@ -1072,9 +1075,6 @@ function wp_upload_dir( $time = NULL ) { if ( !$url = get_option( 'upload_url_path' ) ) $url = trailingslashit( $siteurl ) . $path; - if ( $dir == ABSPATH ) // the option was empty - $dir = ABSPATH . 'wp-content/uploads'; - if ( defined('UPLOADS') ) { $dir = ABSPATH . UPLOADS; $url = trailingslashit( $siteurl ) . UPLOADS;