[pmwiki-users] File upload: leading underscore in filenames deleted

Patrick R. Michaud pmichaud at pobox.com
Sat Jan 13 07:22:47 CST 2007


On Sat, Jan 13, 2007 at 08:53:04AM +0100, Christophe David wrote:
>    When uploading a file having a name starting with an underscore, the
>    underscore is deleted.
> 
>    I could not find documentation about this feature.
> 
>    Is there a way to prevent this behaviour ?

At the moment PmWiki's upload feature is hardcoded to require
that attachments start with an alphanumeric character.
The only way to enable underscores (at the moment) is to
patch scripts/upload.php.  On line 116, change

      $x = preg_replace('/^[^[:alnum:]]+/', '', $x);

to

      $x = preg_replace('/^[^[:alnum:]_]+/', '', $x);

If others think that leading underscores are safe on
attachments, I can see about making this change in the core.

Thanks!

Pm





More information about the pmwiki-users mailing list