fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-04-20 03:20 am

[dw-free] Tiny inefficiency in the content importer, remap_user_friend

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

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

Return early before processing if we weren't able to get a URL.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm
--------------------------------------------------------------------------------
diff -r 6f4a246e970a -r b4ded6f957d3 cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm
--- a/cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm	Wed Apr 20 11:12:08 2011 +0800
+++ b/cgi-bin/DW/Worker/ContentImporter/LiveJournal.pm	Wed Apr 20 11:15:43 2011 +0800
@@ -247,9 +247,10 @@ sub remap_username_friend {
 
         if ( $data =~ m!<ownerName>(.+?)</ownerName>! ) {
             my $url = $1;
+            return undef unless $url;
+
             $url = "http://$url/"
                 unless $url =~ m/^https?:/;
-            return undef unless $url;
 
             if ( $url =~ m!http://(.+)\.$LJ::DOMAIN\/$! ) {
                 # this appears to be a local user!
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org