From: Axel Beckert Date: Tue, 22 Jul 2008 01:46:08 +0000 (+0000) Subject: Bugfix: Default RSS feed failed feed validation at http://www.feedvalidator.org/... X-Git-Tag: v2_1_0~9 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=4ca079445f95088dac8bdc7506aa04696513fb12;p=matthijs%2Fupstream%2Fblosxom.git Bugfix: Default RSS feed failed feed validation at feedvalidator.org/ if there was a blank inside a file name since blanks (and other characters) need to be escaped inside an URL. Most browsers do this, but not all. --- diff --git a/blosxom.cgi b/blosxom.cgi index 341d296..2e6181f 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 = (