[wp-trac] [WordPress Trac] #13483: fileupload_url / upload_url_path

WordPress Trac wp-trac at lists.automattic.com
Sat May 22 00:24:59 UTC 2010


#13483: fileupload_url / upload_url_path
--------------------------+-------------------------------------------------
 Reporter:  jimisaacs     |       Owner:                                                      
     Type:  defect (bug)  |      Status:  new                                                 
 Priority:  high          |   Milestone:  3.0                                                 
Component:  Multisite     |     Version:  3.0                                                 
 Severity:  major         |    Keywords:  multisite attachments fileupload_url upload_url_path
--------------------------+-------------------------------------------------

Comment(by jimisaacs):

 Ok I did some more testing removing my code and going back to the original
 function. What seem weird is this, I set an arbitrary value in the option
 upload_path for a blog I intend to run to the swtich to, and regardless of
 the option, I get :
  "<host>/<site>/files/<image-path>" for the thumbnail urls on the
 template.

 Now, as soon as I remove the arbitrary value in he upload_path option
 (blank), it breaks going back to the wp-content/uploads path as I said
 before.

 I even blanked out the upload_url_path option with and arbitrary value in
 upload_path and it worked. Only doesn't work when upload_path is empty,
 which makes me think it has to do with this logic:

 {{{
 if ( empty($upload_path) ) {
         $dir = WP_CONTENT_DIR . '/uploads';
 } else {
         $dir = $upload_path;
         if ( 'wp-content/uploads' == $upload_path ) {
                 $dir = WP_CONTENT_DIR . '/uploads';
                 $main_override = defined( 'MULTISITE' ) && is_main_site();
         } elseif ( 0 !== strpos($dir, ABSPATH) ) {
                 // $dir is absolute, $upload_path is (maybe) relative to
 ABSPATH
                 $dir = path_join( ABSPATH, $dir );
         }
 }

 if ( !$url = get_option( 'upload_url_path' ) ) {
         if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path
 ) || ( $upload_path == $dir ) )
                 $url = WP_CONTENT_URL . '/uploads';
         else
                 $url = trailingslashit( $siteurl ) . $upload_path;
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13483#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list