/ uri escaped in LWP::Protocol::file

/ uri escaped in LWP::Protocol::file

am 19.09.2004 22:04:48 von kaminsky

--2oS5YaxWCcQjTEyO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

It appears to me there is a small bug in LWP::Protocol::file. The '/'=20
added to the end of each directory member which is itself a directory,=20
is escaped when turning it into a url, making the url quite useless. I=20
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);
=20
# Make directory listing
+ my $pathe =3D $path . ( $^O eq 'MacOS' ? ':' : '/');
for (@files) {
- if($^O eq "MacOS") {
- $_ .=3D "/" if -d "$path:$_";
- }
- else {
- $_ .=3D "/" if -d "$path/$_";
- }
my $furl =3D URI::Escape::uri_escape($_);
+ if ( -d "$pathe$_" ) {
+ $furl .=3D '/';
+ $_ .=3D '/';
+ }
my $desc =3D HTML::Entities::encode($_);
$_ =3D qq{

  • };
    }


    --=20
    I love deadlines. I like the whooshing sound they make as they fly by.=20
    -- Douglas Adams
    =20
    Moshe Kaminsky
    Home: 08-9456841


    --2oS5YaxWCcQjTEyO
    Content-Type: application/pgp-signature
    Content-Disposition: inline

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.6 (GNU/Linux)

    iD8DBQFBTeZgkBjmVsKMBeMRArETAJ9fLqTxk8OX/KMBGzio9cvCyELcKQCg lhbq
    I9D7esNHdoqN1fC9z7+2Bto=
    =+Fs9
    -----END PGP SIGNATURE-----

    --2oS5YaxWCcQjTEyO--

  • Re: / uri escaped in LWP::Protocol::file

    am 15.11.2004 23:54:50 von gisle

    Moshe Kaminsky writes:

    > 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:

    Finally applied. Thanks!

    Regards,
    Gisle


    > --- /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{

  • };
    > }