diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php index 23a0ded35..c5a0a665e 100644 --- a/wp-admin/import/wordpress.php +++ b/wp-admin/import/wordpress.php @@ -105,7 +105,12 @@ class WP_Import { // this doesn't check that the file is perfectly valid but will at least confirm that it's not the wrong format altogether if ( !$is_wxr_file && preg_match('|xmlns:wp="http://wordpress[.]org/export/\d+[.]\d+/"|', $importline) ) $is_wxr_file = true; - + + if ( false !== strpos($importline, '') ) { + preg_match('|(.*?)|is', $importline, $url); + $this->base_url = $url[1]; + continue; + } if ( false !== strpos($importline, '') ) { preg_match('|(.*?)|is', $importline, $category); $this->categories[] = $category[1]; @@ -539,6 +544,11 @@ class WP_Import { function process_attachment($postdata, $remote_url) { if ($this->fetch_attachments and $remote_url) { printf( __('Importing attachment %s... '), htmlspecialchars($remote_url) ); + + // If the URL is absolute, but does not contain http, upload it assuming the base_site_url variable + if ( preg_match('/^\/[\w\W]+$/', $remote_url) ) + $remote_url = rtrim($this->base_url,'/').$remote_url; + $upload = $this->fetch_remote_file($postdata, $remote_url); if ( is_wp_error($upload) ) { printf( __('Remote file error: %s'), htmlspecialchars($upload->get_error_message()) );