[PATCH] Fix for javascript errors related to ' in subject
[email protected] (Richard Soderberg) Mon, 14 Aug 2000 23:46:37 -0700 (PDT)
| Newsgroups | perl.bugmongers |
|---|---|
| Message-ID | <[email protected]> |
Format.pm was passing $subject to a JavaScript variable without escaping
the single quotes in the text. This causes errors - search for %\'%
as the subject field in 2.23, for instance. Patch included; I'm glad to
be rid of these errors. :)
R.
--- Perlbug-2.23/Perlbug/Format.pm Thu Aug 10 23:52:07 2000
+++ Perlbug-new/Perlbug/Format.pm Mon Aug 14 23:41:22 2000
@@ -926,7 +926,11 @@
next ITEM unless defined($val) and $val =~ /\w+/;
my $vis = ($title =~ /\w+/) ? $title : $val;
# Params
- my $status = ($subject =~ /\w+/) ? qq|onMouseOver="status='$subject'"| : '';
+ my $status = '';
+ if ($subject =~ /\w+/) {
+ $subject =~ s/'/\\'/g;
+ $status = qq|onMouseOver="status='$subject'"|;
+ }
$self->debug(3, "status($status), cgi($cgi), key($key), val($val), format($fmt), status($status), vis($vis)");
my $link = qq|<a href="$cgi?req=$key&$key=$val&range=$$&format=$fmt" $status>$vis</a>|;
$self->debug(3, "link: '$link'");