You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jon Evans <jo...@misgl.com> on 2004/06/30 12:26:20 UTC
directory generator - is this behaviour correct?
Hi,
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
/var/share.
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.
Thanks,
Jon