cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Evans <>
Subject directory generator - is this behaviour correct?
Date Wed, 30 Jun 2004 10:26:20 GMT

I've got a pipeline which implements a directory browser beneath a 
certain point in my filesystem (e.g. /var/share).

I want to use the directory generator with a root parameter of 
/var/share, so that users can't browse any higher up than that, but if 
they browse further down I'll be able to create a breadcrumbs view of 
the current directory, because the XML generated will have my requested 
directory wrapped in dir:directory elements all the way back to 

Unfortunately the root parameter doesn't work like that, it's a regexp 
match against path.getName() (path is a File), which means for my 
example I have to set root="share" for it to work.  This will mean that 
the browser will fail to work properly if someone creates another 
directory called "share" somewhere further down the tree.  The user 
will be able to navigate down to the share directory, but at that point 
the breadcrumbs will stop working.

Would it not be better to match the RE against path.getAbsolutePath(), 
so I could pass in my root parameter as /var/share (or "\/var\/share")?

I will raise a bugzilla request with a patch if feedback indicates that 
this would be a good move.  Or alternatively I could create a patch to 
provide a "jail" parameter which is an absolute root path (not a 
regexp) which the generator will be limited to.



View raw message