logo       

/ uri escaped in LWP::Protocol::file: msg#00038

lang.perl.modules.lwp

Subject: / uri escaped in LWP::Protocol::file

Hi,

It appears to me there is a small bug in LWP::Protocol::file. The '/'
added to the end of each directory member which is itself a directory,
is escaped when turning it into a url, making the url quite useless. I
suggest the following patch:

--- /usr/lib/perl5/vendor_perl/5.8.4/LWP/Protocol/file.old 2004-09-19
22:56:35.786858776 +0300
+++ /usr/lib/perl5/vendor_perl/5.8.4/LWP/Protocol/file.pm 2004-09-19
22:56:24.000000000 +0300
@@ -96,14 +96,13 @@
closedir(D);

# Make directory listing
+ my $pathe = $path . ( $^O eq 'MacOS' ? ':' : '/');
for (@files) {
- if($^O eq "MacOS") {
- $_ .= "/" if -d "$path:$_";
- }
- else {
- $_ .= "/" if -d "$path/$_";
- }
my $furl = URI::Escape::uri_escape($_);
+ if ( -d "$pathe$_" ) {
+ $furl .= '/';
+ $_ .= '/';
+ }
my $desc = HTML::Entities::encode($_);
$_ = qq{<LI><A HREF="$furl">$desc</A>};
}


--
I love deadlines. I like the whooshing sound they make as they fly by.
-- Douglas Adams

Moshe Kaminsky <kaminsky@xxxxxxxxxxxxxxx>
Home: 08-9456841

Attachment: pgpVoZRIZ8tuC.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise