[wp-trac] [WordPress Trac] #22157: Detecting MIME Types in WXR Files

WordPress Trac wp-trac at lists.automattic.com
Wed Oct 10 20:54:08 UTC 2012


#22157: Detecting MIME Types in WXR Files
-----------------------------+-------------------------
 Reporter:  ReadyMadeWeb     |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Import
  Version:  3.4.2            |   Severity:  normal
 Keywords:  has-patch        |
-----------------------------+-------------------------
 In the process of creating a service to convert TypePad data to WXR
 formatted files, we've encountered some unique problems with TypePad data.
 Namely, many TypePad files are saved without file extensions, which
 prevents the existing importer from importing those files into the wp-
 content/uploads folder.

 In order to import and rename these otherwise ignored files, we've created
 a patch for the WordPress importer that does the following:

 1. If there is an attachment in the WXR and the importer is not able to
 determine the file type from the file name (ie missing extension), the
 patched version will make a light (body-less) request to the web server
 where the file is hosted for information we can use about the file. The
 things we're interested in are file type, size, and filename.

 2. If the importer is processing an attachment under the above situation,
 and it is able to determine the file type, then it will rewrite the local
 version of the file to have the appropriate file extension.

 This is a simple bit of code, but it makes a huge difference as TypePad
 saves without file extensions quite regularly.

 We've attached our patch and a sample WXR file from ragsgupta.com, the
 Brightcove co-founder's blog.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22157>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list