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-03-15 06:43 am

[dw-free] Wrong URLs for not-there userpics appearing

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

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

Fix bug: LJ::Userpic always returns an object, it doesn't validate the
picid. Therefore, if we don't have a picid, don't create an object.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/LJ/S2.pm
--------------------------------------------------------------------------------
diff -r 9dda78055ea0 -r c8ed0f9ee466 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Sun Mar 15 06:38:24 2009 +0000
+++ b/cgi-bin/LJ/S2.pm	Sun Mar 15 06:43:27 2009 +0000
@@ -2073,6 +2073,7 @@ sub Image_userpic
     my ($u, $picid, $kw) = @_;
 
     $picid ||= LJ::get_picid_from_keyword($u, $kw);
+    return Null("Image") unless $picid;
 
     # get the Userpic object
     my $p = LJ::Userpic->new($u, $picid);
@@ -2091,7 +2092,6 @@ sub Image_userpic
         $alttext = $kwstr;
     }
 
-    return Null("Image") unless $p;
     return {
         '_type' => "Image",
         'url' => "$LJ::USERPIC_ROOT/$picid/$u->{'userid'}",
--------------------------------------------------------------------------------