Bug 109530 - xml.cgi was quoting stuff way too much. This is because it was incorrectly quoted in Bug.pm

r= justdave, louie
This commit is contained in:
jake%acutex.net 2001-11-26 14:16:10 +00:00
Родитель 57b2ac3bb2
Коммит 8faf89a56a
3 изменённых файлов: 16 добавлений и 29 удалений

Просмотреть файл

@ -147,14 +147,6 @@ sub initBug {
} }
} }
if ($self->{'short_desc'}) {
$self->{'short_desc'} = QuoteXMLChars( $self->{'short_desc'} );
}
if (defined $self->{'status_whiteboard'}) {
$self->{'status_whiteboard'} = QuoteXMLChars($self->{'status_whiteboard'});
}
$self->{'assigned_to'} = &::DBID_to_name($self->{'assigned_to'}); $self->{'assigned_to'} = &::DBID_to_name($self->{'assigned_to'});
$self->{'reporter'} = &::DBID_to_name($self->{'reporter'}); $self->{'reporter'} = &::DBID_to_name($self->{'reporter'});
@ -183,7 +175,7 @@ sub initBug {
push(@list, &::FetchOneColumn()); push(@list, &::FetchOneColumn());
} }
if (@list) { if (@list) {
$self->{'keywords'} = &::html_quote(join(', ', @list)); $self->{'keywords'} = join(', ', @list);
} }
} }
@ -198,7 +190,7 @@ sub initBug {
my %attach; my %attach;
$attach{'attachid'} = $attachid; $attach{'attachid'} = $attachid;
$attach{'date'} = $date; $attach{'date'} = $date;
$attach{'desc'} = &::html_quote($desc); $attach{'desc'} = $desc;
push @attachments, \%attach; push @attachments, \%attach;
} }
} }
@ -215,7 +207,7 @@ sub initBug {
my %longdesc; my %longdesc;
$longdesc{'who'} = $who; $longdesc{'who'} = $who;
$longdesc{'bug_when'} = $bug_when; $longdesc{'bug_when'} = $bug_when;
$longdesc{'thetext'} = &::html_quote($thetext); $longdesc{'thetext'} = $thetext;
push @longdescs, \%longdesc; push @longdescs, \%longdesc;
} }
if (@longdescs) { if (@longdescs) {
@ -319,11 +311,11 @@ sub EmitDependList {
} }
sub QuoteXMLChars { sub QuoteXMLChars {
$_[0] =~ s/&/&/g;
$_[0] =~ s/</&lt;/g; $_[0] =~ s/</&lt;/g;
$_[0] =~ s/>/&gt;/g; $_[0] =~ s/>/&gt;/g;
$_[0] =~ s/'/&apos;/g; $_[0] =~ s/'/&apos;/g;
$_[0] =~ s/"/&quot;/g; $_[0] =~ s/"/&quot;/g;
$_[0] =~ s/&/&amp;/g;
# $_[0] =~ s/([\x80-\xFF])/&XmlUtf8Encode(ord($1))/ge; # $_[0] =~ s/([\x80-\xFF])/&XmlUtf8Encode(ord($1))/ge;
return($_[0]); return($_[0]);
} }

Просмотреть файл

@ -147,14 +147,6 @@ sub initBug {
} }
} }
if ($self->{'short_desc'}) {
$self->{'short_desc'} = QuoteXMLChars( $self->{'short_desc'} );
}
if (defined $self->{'status_whiteboard'}) {
$self->{'status_whiteboard'} = QuoteXMLChars($self->{'status_whiteboard'});
}
$self->{'assigned_to'} = &::DBID_to_name($self->{'assigned_to'}); $self->{'assigned_to'} = &::DBID_to_name($self->{'assigned_to'});
$self->{'reporter'} = &::DBID_to_name($self->{'reporter'}); $self->{'reporter'} = &::DBID_to_name($self->{'reporter'});
@ -183,7 +175,7 @@ sub initBug {
push(@list, &::FetchOneColumn()); push(@list, &::FetchOneColumn());
} }
if (@list) { if (@list) {
$self->{'keywords'} = &::html_quote(join(', ', @list)); $self->{'keywords'} = join(', ', @list);
} }
} }
@ -198,7 +190,7 @@ sub initBug {
my %attach; my %attach;
$attach{'attachid'} = $attachid; $attach{'attachid'} = $attachid;
$attach{'date'} = $date; $attach{'date'} = $date;
$attach{'desc'} = &::html_quote($desc); $attach{'desc'} = $desc;
push @attachments, \%attach; push @attachments, \%attach;
} }
} }
@ -215,7 +207,7 @@ sub initBug {
my %longdesc; my %longdesc;
$longdesc{'who'} = $who; $longdesc{'who'} = $who;
$longdesc{'bug_when'} = $bug_when; $longdesc{'bug_when'} = $bug_when;
$longdesc{'thetext'} = &::html_quote($thetext); $longdesc{'thetext'} = $thetext;
push @longdescs, \%longdesc; push @longdescs, \%longdesc;
} }
if (@longdescs) { if (@longdescs) {
@ -319,11 +311,11 @@ sub EmitDependList {
} }
sub QuoteXMLChars { sub QuoteXMLChars {
$_[0] =~ s/&/&amp;/g;
$_[0] =~ s/</&lt;/g; $_[0] =~ s/</&lt;/g;
$_[0] =~ s/>/&gt;/g; $_[0] =~ s/>/&gt;/g;
$_[0] =~ s/'/&apos;/g; $_[0] =~ s/'/&apos;/g;
$_[0] =~ s/"/&quot;/g; $_[0] =~ s/"/&quot;/g;
$_[0] =~ s/&/&amp;/g;
# $_[0] =~ s/([\x80-\xFF])/&XmlUtf8Encode(ord($1))/ge; # $_[0] =~ s/([\x80-\xFF])/&XmlUtf8Encode(ord($1))/ge;
return($_[0]); return($_[0]);
} }

Просмотреть файл

@ -88,12 +88,15 @@ sub sillyness {
$zz = %::target_milestone; $zz = %::target_milestone;
} }
# XML::Parser automatically unquotes characters when it
# parses the XML, so this routine shouldn't be needed
# for anything (see bug 109530).
sub UnQuoteXMLChars { sub UnQuoteXMLChars {
$_[0] =~ s/&amp;/&/g; $_[0] =~ s/&amp;/&/g;
$_[0] =~ s/&lt;/</g; $_[0] =~ s/&lt;/</g;
$_[0] =~ s/&gt;/>/g; $_[0] =~ s/&gt;/>/g;
$_[0] =~ s/&apos;/'/g; $_[0] =~ s/&apos;/'/g; # ' # Darned emacs colors
$_[0] =~ s/&quot;/"/g; $_[0] =~ s/&quot;/"/g; # " # Darned emacs colors
# $_[0] =~ s/([\x80-\xFF])/&XmlUtf8Encode(ord($1))/ge; # $_[0] =~ s/([\x80-\xFF])/&XmlUtf8Encode(ord($1))/ge;
return($_[0]); return($_[0]);
} }
@ -318,7 +321,7 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
$long_description .= "$sorted_descs[$z]->{'bug_when'}"; $long_description .= "$sorted_descs[$z]->{'bug_when'}";
$long_description .= " ----\n\n"; $long_description .= " ----\n\n";
} }
$long_description .= UnQuoteXMLChars($sorted_descs[$z]->{'thetext'}); $long_description .= $sorted_descs[$z]->{'thetext'};
$long_description .= "\n"; $long_description .= "\n";
} }
@ -351,12 +354,12 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
if ( (defined $bug_fields{'bug_file_loc'}) && ($bug_fields{'bug_file_loc'}) ){ if ( (defined $bug_fields{'bug_file_loc'}) && ($bug_fields{'bug_file_loc'}) ){
push (@query, "bug_file_loc"); push (@query, "bug_file_loc");
push (@values, SqlQuote(UnQuoteXMLChars($bug_fields{'bug_file_loc'}))); push (@values, SqlQuote($bug_fields{'bug_file_loc'}));
} }
if ( (defined $bug_fields{'short_desc'}) && ($bug_fields{'short_desc'}) ){ if ( (defined $bug_fields{'short_desc'}) && ($bug_fields{'short_desc'}) ){
push (@query, "short_desc"); push (@query, "short_desc");
push (@values, SqlQuote(UnQuoteXMLChars($bug_fields{'short_desc'})) ); push (@values, SqlQuote($bug_fields{'short_desc'}) );
} }