[wp-trac] [WordPress Trac] #15325: Importer tries to open XML file in wrong location on Windows

WordPress Trac wp-trac at lists.automattic.com
Sat Nov 6 10:38:47 UTC 2010


#15325: Importer tries to open XML file in wrong location on Windows
--------------------------+-------------------------------------------------
 Reporter:  Viper007Bond  |       Owner:  duck_
     Type:  defect (bug)  |      Status:  new  
 Priority:  normal        |   Milestone:  3.1  
Component:  Import        |     Version:  3.1  
 Severity:  blocker       |    Keywords:       
--------------------------+-------------------------------------------------

Comment(by duck_):

 This isn't a problem with the WXR importer itself, but the supporting core
 functions for all importers.

 This is mainly just guesswork based on the code since... It looks like the
 problem is occurring in `get_attached_file` where the
 [http://core.trac.wordpress.org/browser/trunk/wp-includes/post.php#L165
 condition on line 165] is being evaluated to true. I believe the problem
 is being introduced because of the use of `addslashes` in
 `wp_import_handle_upload`. The extra slashes stop the removal of path to
 the upload dir part (`_wp_relative_upload_path`) so `update_metadata` gets
 the full slashed path, `stripslashes` this and sends it on to
 `add_metadata` which `stripslashes` again and stores the full path but
 without the Windows `/`s. Leading to the failed preg_match I mentioned at
 the beginning.

 tl;dr the root cause seems to be `addslashes` in `wp_import_handle_upload`
 we should probably emulate `media_handle_upload` more.

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


More information about the wp-trac mailing list