wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r18625: LJSUP-8242. error Can't locate object me...

Committer: gprochaev
LJSUP-8242. error Can't locate object method "host"

U   trunk/cgi-bin/LJ/Browse/Parser.pm
Modified: trunk/cgi-bin/LJ/Browse/Parser.pm
===================================================================
--- trunk/cgi-bin/LJ/Browse/Parser.pm	2011-03-18 07:18:00 UTC (rev 18624)
+++ trunk/cgi-bin/LJ/Browse/Parser.pm	2011-03-18 07:40:32 UTC (rev 18625)
@@ -2,6 +2,8 @@
 
 use strict;
 
+use URI;
+
 ## Parsing text for Landing Page
 ## args:
 ##      text => Text to parse
@@ -39,6 +41,15 @@
 
             ## resize and crop first image from post if exist
             if ($tag eq 'img') {
+                my $src = $attr->{'src'};
+                ## SRC must be exist
+                next unless $src;
+
+                my $uri = URI->new($src);
+                my $host = eval { $uri->host };
+                ## Img URL must be valid
+                next if $@;
+
                 my $r = $images_crop_cnt ? LJ::crop_picture_from_web(
                     source      => $attr->{'src'},
                     size        => '200x200',

Tags: livejournal, pm, wisest-owl
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