vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r19438: LJSV-1667: Error 500 showed at address o...

Committer: vad
LJSV-1667: Error 500 showed at address of reposted entry and on recent pages in some journal on page contained reposted entry, if sourse reposted entry was deleted.
U   trunk/cgi-bin/cleanhtml.pl
Modified: trunk/cgi-bin/cleanhtml.pl
===================================================================
--- trunk/cgi-bin/cleanhtml.pl	2011-07-05 10:05:00 UTC (rev 19437)
+++ trunk/cgi-bin/cleanhtml.pl	2011-07-05 10:59:13 UTC (rev 19438)
@@ -727,7 +727,7 @@
                 my $entry = LJ::Entry->new_from_url($entry_url);
 
                 my $meta = { map { $_ => '' } qw( title description image ) };
-                if ($entry) {
+                if ($entry and $entry->valid) {
                     $meta = $entry->extract_metadata;
                 }
 
@@ -827,6 +827,8 @@
 
                     elsif ( $button eq 'livejournal' ) {
                         my $entry = LJ::Entry->new_from_url($entry_url);
+                           $entry = undef unless $entry->valid;
+
                         my $give_button = LJ::run_hook("give_button", {
                             'journal' => $entry ? $entry->journal->user : '',
                             'itemid'  => $entry ? $entry->ditemid : 0,
@@ -1285,8 +1287,14 @@
                         $subject = LJ::ehtml($entry->subject_raw || LJ::Lang::ml("repost.default_subject"));
                         $subject = Encode::decode_utf8($subject) if $subject;
                     }
+
+                    ## 'posterid' property of a removed (is_valied eq 'false') entry is empty.
+                    my $poster_username = $entry->poster
+                                            ? $entry->poster->username
+                                            : '';
+
                     $captured = LJ::Lang::ml("repost.wrapper", {
-                                                username => $entry->poster->username,
+                                                username => $poster_username,
                                                 url      => $entry->url,
                                                 subject  => $subject,
                                                 text     => $captured,

Tags: livejournal, pl, vadvs
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments