Comment 18 for bug 191199

Revision history for this message
In , Rhg-marxmeier (rhg-marxmeier) wrote :

I found another problem caused by the QuoteXMLChars function in Bug.pm regarding
the '&' -> '&' conversion.

If I have for example a sequence like '->' in a bug description it is converted
to '->' when exporting this bug with xml.cgi.

Seems to be caused by QuoteXMLChars to be applied more than once on the same
field, thus first converting '>' to '&gt' and then '&gt' to '>'.

The solution is an additional look-ahead in QuoteXMLChars:
  $_[0] =~ s/&/&/g;
should be replaced with
  $_[0] =~ s/&(?![#A-Za-z][0-9A-Za-z]+;)/&/g;

This way, a '&' is not touched if it is used as a character prefix (as in >
or Ä or ™).