Fix ad-hoc URI escaping to be more robusy, per Gavin Sherry (by way of
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 27 May 2009 19:52:45 +0000 (19:52 +0000)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 27 May 2009 19:52:45 +0000 (19:52 +0000)
Stefan Kaltenbrunner)

git-svn-id: file:///Users/dpage/pgweb/svn-repo/trunk@2500 8f5c7a92-453e-0410-a47f-ad33c8a6b003

archives/bin/msgid2link.pl

index efe96fb657c86a0a5aa5d3ebf3015156cfda80f7..6b786008a9f78a2a19efa7a2d4707d0e988487a0 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
+use URI::Escape;
 
 sub sysdie { die "$0: @_: $!\n" }
 
@@ -43,12 +44,10 @@ while (my $in_filename = glob("msg*.php"))
                        s/\(at\)/@/g;
                        m/^(.*&lt;)(.*)(&gt;)(<\/li>)$/;
                        my $lead = $1;
-                       my $link = $2;
+                       my $link = uri_escape($2);
                        my $ulink = $2;
                        my $trailer = $3;
                        my $eol = $4;
-                       # do we need more HTML de-escaping?
-                       $link =~ s/&amp;/&/g;
                        print $OUT qq{$lead<a href="http://archives.postgresql.org/message-id/$link">$ulink</a>$trailer &lt;<a href="http://archives.postgresql.org/msgtxt.php?id=$link">text/plain</a>>$eol};
                        $changes = 1;
                }