[wp-trac] [WordPress Trac] #11144: WP importer strips whitespace at EOL, problem with Markdown

WordPress Trac wp-trac at lists.automattic.com
Sat Feb 27 06:39:13 UTC 2010


#11144: WP importer strips whitespace at EOL, problem with Markdown
--------------------------+-------------------------------------------------
 Reporter:  demetris      |       Owner:             
     Type:  defect (bug)  |      Status:  new        
 Priority:  normal        |   Milestone:  3.0        
Component:  Import        |     Version:  2.9        
 Severity:  normal        |    Keywords:  needs-patch
--------------------------+-------------------------------------------------

Comment(by dwright):

 Replying to [comment:13 demetris]:
 > Thanks for the reply, dwright.
 >
 > So, in your tests, importing does not affect strings of spaces before
 EOLs.
 >
 > While in my tests those strings of spaces are completely removed.  (I
 also verified the issue by looking at the post_content in the DB entry.)

 So you are saying it looks like it's working as desired in my environment
 and not in yours?

 If so, are you sure the patch applied?

 Take this session:

 post as originally written:

 {{{
 mysql>  select post_content from wp_posts where ID=6;
 +------------------------+
 | post_content           |
 +------------------------+
 | test



           |
 +------------------------+
 }}}

 export xml file.
 post deleted. (and trash emptied)
 xml file imported (without patch)

 {{{
 mysql>  select post_content from wp_posts where ID=6;
 +--------------+
 | post_content |
 +--------------+
 | test         |
 +--------------+
 1 row in set (0.00 sec)
 }}}

 This is the behaviour I believe you are seeing, correct?


 Now, apply the patch:

 {{{
 [dwright:wordpress]$ patch wp-admin/import/wordpress.php < wp-
 admin/import/wordpress.php.patch
 patching file wp-admin/import/wordpress.php
 [dwright:wordpress]$ svn diff
 Index: wp-admin/import/wordpress.php
 ===================================================================
 --- wp-admin/import/wordpress.php       (revision 13450)
 +++ wp-admin/import/wordpress.php       (working copy)
 @@ -56,7 +56,8 @@
                 preg_match("|<$tag.*?>(.*?)</$tag>|is", $string, $return);
                 if ( isset($return[1]) ) {
                         $return =
 preg_replace('|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1]);
 -                       $return = $wpdb->escape( trim( $return ) );
 +                       if ($tag == 'content:encoded') $return =
 $wpdb->escape( trim( $return, "\t\0\x0B" ) );
 +                       else $return = $wpdb->escape( trim( $return ) );
                 } else {
                         $return = '';
                 }
 }}}

 delete post ID=6; empty trash; restart webserver and import the same xml
 file.

 {{{
 mysql>  select post_content from wp_posts where ID=6;
 +-------------------+
 | post_content      |
 +-------------------+
 | test



           |
 +-------------------+
 1 row in set (0.00 sec)
 }}}

 This is the result I believe you want correct?

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


More information about the wp-trac mailing list