afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-04-21 07:11 pm

[dw-free] Javascript userpic picker breaks when description has quotes

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

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

Escape alt text for javascript

Patch by [personal profile] jadelennox.

Files modified:
  • cgi-bin/LJ/Widget/UserpicDisplay.pm
  • cgi-bin/weblib.pl
--------------------------------------------------------------------------------
diff -r 1030e3640f02 -r 3c6a25f07976 cgi-bin/LJ/Widget/UserpicDisplay.pm
--- a/cgi-bin/LJ/Widget/UserpicDisplay.pm	Wed Apr 22 01:53:59 2009 +0800
+++ b/cgi-bin/LJ/Widget/UserpicDisplay.pm	Tue Apr 21 19:10:53 2009 +0000
@@ -64,7 +64,7 @@ sub render_body {
         $num = 0;
         foreach ( @{$res->{pickws}} ) {
            $num++;
-           $altcode .= "     alttext[$num] = \"$_\";\n";
+           $altcode .= "     alttext[$num] = \"" . LJ::ejs($_) . "\";\n";
         }
 
         my $userpic_link_text;
diff -r 1030e3640f02 -r 3c6a25f07976 cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl	Wed Apr 22 01:53:59 2009 +0800
+++ b/cgi-bin/weblib.pl	Tue Apr 21 19:10:53 2009 +0000
@@ -1022,7 +1022,7 @@ sub entry_form {
                 $num = 0;
                 foreach ( @{$res->{pickws}} ) {
                     $num++;
-                    $altcode .= "     alttext[$num] = \"$_\";\n";
+                    $altcode .= "     alttext[$num] = \"" . LJ::ejs($_) . "\";\n";
                 }
                 $$onload .= " userpic_preview();";
 
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org