fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-11-15 07:54 am

[dw-free] Empty keyword breaks keyword mapping for users on dversion 9

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

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

This shouldn't happen, but it does, so take it into account before putting
it into memcache. Othewrwise, it interferes with our aability to pull the
data back out again (Thanks to [personal profile] exor674 for working with me on
debugging this!)

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/LJ/User.pm
--------------------------------------------------------------------------------
diff -r 6a02b7b7a1b1 -r 80c58c8a06db cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Mon Nov 15 13:01:18 2010 +0800
+++ b/cgi-bin/LJ/User.pm	Mon Nov 15 15:54:42 2010 +0800
@@ -6906,6 +6906,10 @@ sub get_userpic_info {
         my %picmap;
         my %kwmap;
         while (my ($kw, $id, $mapid, $redir) = $sth->fetchrow_array) {
+
+            # used to be a bug that allowed these to get in.
+            next if $kw =~ /[\n\r\0]/ || ( defined $kw && length($kw) == 0 );
+
             my $skip_kw = 0;
             if ( $mapped_icons ) {
                 $picmap{$mapid} = [ int($id), int($redir) ];
@@ -6921,8 +6925,8 @@ sub get_userpic_info {
                 }
             }
             next if $skip_kw;
+
             next unless $info->{pic}->{$id};
-            next if $kw =~ /[\n\r\0]/;  # used to be a bug that allowed these to get in.
             $info->{kw}->{$kw} = $info->{pic}->{$id};
             $info->{mapid}->{$mapid} = $info->{pic}->{$id} if $mapped_icons && $id;
             $minfokw{$kw} = int($id);
--------------------------------------------------------------------------------