mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-04-19 05:14 am

[dw-free] Allow importing of your journal from another LiveJournal-based site.

[commit: http://hg.dwscoalition.org/dw-free/rev/fff547444540]

http://bugs.dwscoalition.org/show_bug.cgi?id=114

Fix two issues: undef warnings in encode_utf8 and a rare case where imports
would simply fail if the comment is an orphan.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/DW/Worker/ContentImporter/LiveJournal/Comments.pm
--------------------------------------------------------------------------------
diff -r 2b16c8563c98 -r fff547444540 cgi-bin/DW/Worker/ContentImporter/LiveJournal/Comments.pm
--- a/cgi-bin/DW/Worker/ContentImporter/LiveJournal/Comments.pm	Sun Apr 19 04:16:10 2009 +0000
+++ b/cgi-bin/DW/Worker/ContentImporter/LiveJournal/Comments.pm	Sun Apr 19 05:14:30 2009 +0000
@@ -273,7 +273,8 @@ sub try_work {
 
         # the reverse of unresolved, tell the parent it has visible children
         $meta{$comment->{parentid}}->{has_children} = 1
-            if $comment->{parentid} && $comment->{state} ne 'D';
+            if exists $meta{$comment->{parentid}} &&
+               $comment->{parentid} && $comment->{state} ne 'D';
 
         # remap content (user links) then remove embeds/templates
         my $body = $class->remap_lj_user( $data, $comment->{body} );
@@ -283,8 +284,8 @@ sub try_work {
 
         # now let's do some encoding, just in case the input we get is in some other
         # character encoding
-        $comment->{body} = encode_utf8( $comment->{body} );
-        $comment->{subject} = encode_utf8( $comment->{subject} );
+        $comment->{body} = encode_utf8( $comment->{body} || '' );
+        $comment->{subject} = encode_utf8( $comment->{subject} || '' );
     }
 
     # variable setup for the database work
--------------------------------------------------------------------------------