[pmwiki-users] bug in uploads ?

Eemeli Aro eemeli at gmail.com
Fri Apr 4 04:11:12 CDT 2008


On Thu, Apr 3, 2008 at 3:01 PM, Alain Castera <alain.castera at in2p3.fr> wrote:
>  Where am I wrong. How can I avoid this behavior without worrying about
>  each new page name !

By not worrying about it.

Links to attachments are handled by the function LinkUpload in
scripts/upload.php. If your Attach:something reference includes a '/'
in the something, it'll take the part before the last '/' and turn it
into a valid page name. For example, if it's just a group, say
'Attach:Foo/file.ext', that'll become 'Foo.Foo'. If you don't have a
'/' it'll use the current page name. Then the remaining part is turned
into a valid file name.

Now the function looks at the value of a variable $UploadFileFmt which
by default is "$UploadDir$UploadPrefixFmt/filename", where those two
variables are by default 'uploads' and '/$Group' & filename is eg.
'file.ext', and parses all of this from the point of view of the given
page (eg. for the page 'Foo.Foo', $Group means 'Foo'). This results in
the default behaviour of sorting attachments into directories by
group.

In other words, don't worry about it. If you want to worry about
something, worry about being careful how uploads can be accessed. With
the default settings, even though uploads are saved by group, their
access permissions are read from the page that you declare to be
accessing them from. So if you have a group 'Foo' that has a groupwide
read password, but it has a page 'Foo.Bar' which requires no read
password, Attach:Foo/file.ext will ask for your password but
Attach:Foo.Bar/file.ext won't.

eemeli



More information about the pmwiki-users mailing list