Small bug in LWP/Protocol/file.pm

Carey (c.evans@student.canterbury.ac.nz)
Tue, 07 Jan 1997 12:40:26 +1300 (NZDT)


LWP/Protocol/file.pm in LWP 5.05 has a small problem when handling files
with strange names, containing characters such as #?<>&.  The small patch
below fixes almost all problems associated with this, except for multiple
spaces and any control characters in filenames.

*** file.pm.old	Tue Oct 29 14:01:39 1996
--- file.pm	Tue Jan  7 12:39:02 1997
***************
*** 10,15 ****
--- 10,18 ----
  require HTTP::Status;
  require HTTP::Date;
  
+ require URI::Escape;
+ require HTML::Entities;
+ 
  use Carp;
  
  @ISA = qw(LWP::Protocol);
***************
*** 101,107 ****
  	# Make directory listing
  	for (@files) {
  	    $_ .= "/" if -d "$path/$_";
! 	    $_ = qq{<LI> <a href="$_">$_</a>};
  	}
  	# Ensure that the base URL is "/" terminated
  	my $base = $url->clone;
--- 104,112 ----
  	# Make directory listing
  	for (@files) {
  	    $_ .= "/" if -d "$path/$_";
! 	    my $furl = URI::Escape::uri_escape($_);
! 	    my $desc = HTML::Entities::encode($_);
! 	    $_ = qq{<LI><A HREF="$furl">$desc</A>};
  	}
  	# Ensure that the base URL is "/" terminated
  	my $base = $url->clone;

-- 
            Carey Evans  <*>  c.evans@student.canterbury.ac.nz

              "As a concept, virtual reality seems to appeal
               to people who spend a lot of time indoors."  - Gregory Benford