Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r16117: LJSUP-5438: do not try to do decode entr...

Committer: ailyin
LJSUP-5438: do not try to do decode entry text in case we don't care

U   trunk/cgi-bin/LJ/EmbedModule.pm
Modified: trunk/cgi-bin/LJ/EmbedModule.pm
===================================================================
--- trunk/cgi-bin/LJ/EmbedModule.pm	2010-01-21 12:38:13 UTC (rev 16116)
+++ trunk/cgi-bin/LJ/EmbedModule.pm	2010-01-22 05:53:14 UTC (rev 16117)
@@ -136,7 +136,6 @@
 
     return if LJ::conf_test($LJ::DISABLED{embed_module});
 
-    $$postref = Encode::decode_utf8($$postref);
     # fast track out if we don't have to expand anything
     return unless $$postref =~ /lj\-embed|embed|object/i;
 
@@ -154,10 +153,12 @@
         return $class->expand_entry($journal, $postref, %opts);
     }
 
+    my $text = Encode::decode_utf8($$postref);
+
     # ok, we can safely parse post text
     # machine state
     my $state = REGULAR;
-    my $p = HTML::TokeParser->new($postref);
+    my $p = HTML::TokeParser->new(\$text);
     my $newtxt = '';
     my %embed_attrs = (); # ($eid, $ewidth, $eheight);
     my $embed = '';
@@ -246,8 +247,7 @@
     }
 
     # update passed text
-    $$postref = $newtxt;
-    $$postref = Encode::encode_utf8($$postref);
+    $$postref = Encode::encode_utf8($newtxt);
 }
 
 sub module_iframe_tag {

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