You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Alexei Barantsev <ba...@kazbek.ispras.ru> on 2001/04/17 08:50:24 UTC

Apache::AutoIndex - problem with special symbols in filenames (patch applied)

Dear colleagues!

I have found that Apache::AutoIndex does not handle correctly filenames with
special symbols - whitespaces, <, > and so on.

The following patch solves the problem:

bash$ diff -U1 `pwd`/AutoIndex.pm
/usr/lib/perl5/site_perl/5.005/i386-linux/Apache/AutoIndex.pm
--- /usr/src/cpan/build/Apache-AutoIndex-0.08/AutoIndex.pm      Tue Jun 29
21:10:35 1999
+++ /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/AutoIndex.pm       Thu
May 11 12:05:39 2000
@@ -6,3 +6,3 @@
 use DynaLoader ();
-use Apache::Util qw(ht_time size_string);
+use Apache::Util qw(ht_time size_string escape_uri);
 use Apache::ModuleConfig;
@@ -151,3 +151,3 @@
         foreach my $file ( readdir DH ){
-            print "\t<LI><A HREF=\"$file\">$file</A></LI>\n";
+            print "\t<LI><A
HREF=\"".escape_uri($file)."\">$file</A></LI>\n";
             }
@@ -223,3 +223,3 @@
         if ($cfg->{options} & ICONS_ARE_LINKS) {
-            print "<TD><a href=\"$entry";
+            print "<TD><a href=\"".escape_uri($entry);
                print "/" if $list->{$entry}{sizenice} eq '-';
@@ -232,3 +232,3 @@
         #Name
-        print "<TD><a href=\"$entry";
+        print "<TD><a href=\"".escape_uri($entry);
            print "/" if $list->{$entry}{sizenice} eq '-';

Thank you!

Sincerely,
Alexei

--
Alexei Barantsev, ISP RAS
E-mail: barancev@kazbek.ispras.ru
Phone : 912-53-17 (ex.4428)
ICQ   : 3959207


Re: Apache::AutoIndex - problem with special symbols in filenames (patch applied)

Posted by "Philippe M . Chiasson" <go...@cpan.org>.
On Tue, Apr 17, 2001 at 09:29:22AM +0100, G.W. Haywood wrote:
> Hi there,
> 
> On Tue, 17 Apr 2001, Alexei Barantsev wrote:
> 
> > I have found that Apache::AutoIndex does not handle correctly filenames with
> > special symbols - whitespaces, <, > and so on.
> 
> Are you *sure* you want to have those symbols in your filenames??

Well, if it's generating links to actual files, it should make sure the
links are always valid ones, not escaping there characters would possibly
break HTML specs in the output and generate links you can't click on.

So I will apply this patch.

Thanks.

> 73,
> Ged.
> 
> 

-- 
+-----------------------------------------------+
| Philippe M. Chiasson  <go...@cpan.org>        |
| SmartWorker http://www.smartworker.org        |
|     IM : gozerhbe  ICQ : gozer/18279998       |
|   64.8% computer corrupt according to         |
| http://www.freespeech.org/ljk/purity.html     |
+-----------------------------------------------+
Those who learn from history are doomed to have it repeated
to them anyway. 
	-- Larry Wall

perl -e '$$=\${gozer};{$_=unpack(P26,pack(L,$$));/^Just Another Perl Hacker!\n$/&&print||$$++&&redo}'

Re: Apache::AutoIndex - problem with special symbols in filenames (patch applied)

Posted by "G.W. Haywood" <ge...@www.jubileegroup.co.uk>.
Hi there,

On Tue, 17 Apr 2001, Alexei Barantsev wrote:

> I have found that Apache::AutoIndex does not handle correctly filenames with
> special symbols - whitespaces, <, > and so on.

Are you *sure* you want to have those symbols in your filenames??

73,
Ged.