maxmuen Downloading a folder with square brackets in there name will result in 'No files to zip!' error.
OK. I have been looking into this. Two things:
1. Next Files gallery release will download and create zip in browser.
This is much more flexible than the server-zip method, and I can confirm that it does not care about [brackets] in folder names. Server ZIP will still be an option, but browser-download will be the new default.
2. PHP glob()
and [brackets] is a big mess.
maxmuen $glob_dir = preg_replace('[\[\]*?\\\\]', '\\\\\\0', $dir);
This does not work on Mac. I'm assuming the fix above will only work on Windows.
This works on Mac, but guessing it fails on Windows because of \
backslash:
$glob_dir = str_replace(['[', ']'], ['\[', '\]'], $dir);
The only cross-platform solution that seems to work, is a long fix noted in these posts:
https://stackoverflow.com/a/34900391/3040364
https://bugs.php.net/bug.php?id=33047#1237241408
Brackets and PHP glob()
is really a bad combination, and is the reason it's actually listed as a"bug" (see above link), and as noted in this post this is a common problem:
https://seld.be/notes/major-glob-fail/
Considering the awkwardness of the solution, and that in next release we are moving towards browser-based zip download (which supports [brackets] nicely), this circumstantial bug will not be fixed.