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] changelog2010-01-06 12:33 am

[dw-free] Crossposter fails when cut text attribute contains certain HTML entities

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

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

Some characters in cut text attributes were causing crossposts to fail.
Switch to use HTML::Entities which does things correctly.

Patch by [personal profile] allen.

Files modified:
  • cgi-bin/DW/External/XPostProtocol/LJXMLRPC.pm
--------------------------------------------------------------------------------
diff -r 75f98a293c1d -r 6f2475049809 cgi-bin/DW/External/XPostProtocol/LJXMLRPC.pm
--- a/cgi-bin/DW/External/XPostProtocol/LJXMLRPC.pm	Wed Jan 06 00:29:51 2010 +0000
+++ b/cgi-bin/DW/External/XPostProtocol/LJXMLRPC.pm	Wed Jan 06 00:33:22 2010 +0000
@@ -20,6 +20,7 @@ use warnings;
 
 use Digest::MD5 qw(md5_hex);  
 use XMLRPC::Lite;
+use HTML::Entities ();
 
 # create a new instance of LJXMLRPC
 sub instance {
@@ -483,7 +484,7 @@ sub clean_lj_tags {
                 $newdata .= "<$tag";
                 # output attributes in original order
                 foreach (@$attrs) {
-                    $newdata .= " $_=\"" . LJ::ehtml($hash->{$_}) . "\""
+                    $newdata .= " $_=\"" . HTML::Entities::encode( $hash->{$_} ) . "\""
                         if exists $hash->{$_};
                 }
                 $newdata .= " /" if $slashclose;
--------------------------------------------------------------------------------