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-02-20 09:56 am

[dw-free] Userpics disappear when memcache is enabled

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

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

Fix disappearing userpics.

Patch by Andrea Nall <anall@andreanall.com>.

--------------------------------------------------------------------------------
diff -r a4b522627a75 -r 10d5f9809424 cgi-bin/ljuserpics.pl
--- a/cgi-bin/ljuserpics.pl	Fri Feb 20 09:54:54 2009 +0000
+++ b/cgi-bin/ljuserpics.pl	Fri Feb 20 09:56:57 2009 +0000
@@ -303,11 +303,11 @@ sub get_userpic_info
         if ($u->{'dversion'} > 6) {
 
             # Load picture comments
-            if ($opts->{'load_comments'}) {
+            if ( $opts->{'load_comments'} ) {
                 my $commemkey = [$u->{'userid'}, "upiccom:$u->{'userid'}"];
                 my $comminfo = LJ::MemCache::get($commemkey);
 
-                if ($comminfo) {
+                if ( defined( $comminfo ) ) {
                     my ($pos, $nulpos);
                     $pos = $nulpos = 0;
                     while (($nulpos = index($comminfo, "\0", $pos)) > 0) {
@@ -325,11 +325,11 @@ sub get_userpic_info
             }
 
             # Load picture urls
-            if ($opts->{'load_urls'} && $info) {
+            if ( $opts->{'load_urls'} && $info ) {
                 my $urlmemkey = [$u->{'userid'}, "upicurl:$u->{'userid'}"];
                 my $urlinfo = LJ::MemCache::get($urlmemkey);
 
-                if ($urlinfo) {
+                if ( defined( $urlinfo ) ) {
                     my ($pos, $nulpos);
                     $pos = $nulpos = 0;
                     while (($nulpos = index($urlinfo, "\0", $pos)) > 0) {
@@ -344,13 +344,13 @@ sub get_userpic_info
                     undef $info;
                 }
             }
-            
+
             # Load picture descriptions
-            if ($opts->{'load_descriptions'}) {
+            if ( $opts->{'load_descriptions'} && $info ) {
                 my $descmemkey = [$u->{'userid'}, "upicdes:$u->{'userid'}"];
                 my $descinfo = LJ::MemCache::get($descmemkey);
 
-                if ($descinfo) {
+                if ( defined ( $descinfo ) ) {
                     my ($pos, $nulpos);
                     $pos = $nulpos = 0;
                     while (($nulpos = index($descinfo, "\0", $pos)) > 0) {
--------------------------------------------------------------------------------