[contentbox-filebrowser] - ModuleConfig filter regex clarification

ContentBox’s FileBrowser module has the following regex settings in the ModuleConfig file:

// Image Name filtering applies to both files and directories. This is also a regex. Where the filterType=image.
imgNameFilter = “^((?!.).)*$|.+.(jpg|jpeg|bmp|gif|png)/? ",
// Flash Name filtering applies to both files and directories. This is also a regex. Where the filterType=flash.
flashNameFilter = "^((?!.).)
$|.+.(swf|fla)/? *”,

What is the intent of putting “/? *” at the end of these?

Neither the comment above nor the commit message shed any light on what is being attempted, but since the patterns are applied to file/directory names (not paths), the optional slash wont match and spaces are unlikely (and, since there’s no anchor, unnecessary), so I’m wondering why they are there.

Also, without an end-of-string anchor this will accept stuff like “not.swf.really” as a flash file, which is probably not what is wanted.

If someone can explain what’s supposed to be matched/excluded I can submit a pull request with appropriate patterns, but at the moment I don’t see what it’s trying to do, so not sure what a fix needs.

These filters are used to show or not files in the file manager. Pull requests accepted?

The reality is that I do not remember why I chose that regex, it was so long ago :slight_smile:

Luis Majano
CEO
Ortus Solutions, Corp

P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org
ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox