diff options
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/Upload/AssemblyStream.php | 2 | ||||
-rw-r--r-- | apps/dav/tests/unit/Upload/AssemblyStreamTest.php | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/apps/dav/lib/Upload/AssemblyStream.php b/apps/dav/lib/Upload/AssemblyStream.php index 3a18f91677d..b623f717b31 100644 --- a/apps/dav/lib/Upload/AssemblyStream.php +++ b/apps/dav/lib/Upload/AssemblyStream.php @@ -67,7 +67,7 @@ class AssemblyStream implements \Icewind\Streams\File { $nodes = $this->nodes; // http://stackoverflow.com/a/10985500 @usort($nodes, function(IFile $a, IFile $b) { - return strcmp($a->getName(), $b->getName()); + return strnatcmp($a->getName(), $b->getName()); }); $this->nodes = $nodes; diff --git a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php index 66aea40ef22..69ee52299e9 100644 --- a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php +++ b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php @@ -52,6 +52,15 @@ class AssemblyStreamTest extends \Test\TestCase { function providesNodes() { $data8k = $this->makeData(8192); $dataLess8k = $this->makeData(8191); + + $tonofnodes = []; + $tonofdata = ""; + for ($i = 0; $i < 101; $i++) { + $thisdata = rand(0,100); // variable length and content + $tonofdata .= $thisdata; + array_push($tonofnodes, $this->buildNode($i,$thisdata)); + } + return[ 'one node zero bytes' => [ '', [ @@ -90,6 +99,9 @@ class AssemblyStreamTest extends \Test\TestCase { $this->buildNode('1', $data8k . 'X'), $this->buildNode('0', $data8k) ]], + 'a ton of nodes' => [ + $tonofdata, $tonofnodes + ] ]; } |