readdir is not guaranteed to be in order

readdir's ordering is filesystem-dependent. On many systems, that means it
might as well be random. People uploading archives will reasonably expect the
files to appear in alphabetical order, so we should make sure they do.
This commit is contained in:
Justin Brewer 2013-08-11 17:52:38 -05:00
parent 305e25f676
commit 946dec9415

View file

@ -74,7 +74,14 @@ class ArchiveFileHandler extends Extension {
$list = "";
$dir = opendir("$base/$subdir");
while($filename = readdir($dir)) {
$files = array();
while($f = readdir($dir)) {
$files[] = $f;
}
sort($files);
foreach($files as $filename) {
$fullpath = "$base/$subdir/$filename";
if(is_link($fullpath)) {