X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fblosxom.git;a=blobdiff_plain;f=blosxom.cgi;h=3ebe972c88108cbcb1746d2fc513da371bc63565;hp=341d2967c87773a2922f7975c4ddef395afa8bfe;hb=f58f1e6d9a3d9e8f31c8bb80e3a422f4312109ba;hpb=3de8259e6bfdb18b5fc581c8f327f6cf0f3bf19d diff --git a/blosxom.cgi b/blosxom.cgi index 341d296..3ebe972 100755 --- a/blosxom.cgi +++ b/blosxom.cgi @@ -661,6 +661,15 @@ sub generate { } if ( $encode_xml_entities && $content_type =~ m{\bxml\b} ) { + # Escape special characters inside the container + + # The following line should be moved more towards to top for + # performance reasons -- Axel Beckert, 2008-07-22 + my $url_escape_re = qr([^-/a-zA-Z0-9:._]); + + $url =~ s($url_escape_re)(sprintf('%%%02X', ord($&)))eg; + $path =~ s($url_escape_re)(sprintf('%%%02X', ord($&)))eg; + $fn =~ s($url_escape_re)(sprintf('%%%02X', ord($&)))eg; # Escape <, >, and &, and to produce valid RSS my %escape = ( @@ -784,7 +793,7 @@ rss story $title rss story $dw, $da $mo $yr $ti:00 $utc_offset rss story $url/$yr/$mo_num/$da#$fn rss story $path -rss story $path/$fn +rss story $url$path/$fn rss story $body rss story