]> source.dussan.org Git - nextcloud-server.git/commitdiff
backport NAN undefined fix for total file size
authorJörn Friedrich Dreyer <jfd@butonic.de>
Tue, 6 Nov 2012 11:40:22 +0000 (12:40 +0100)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Tue, 6 Nov 2012 11:40:22 +0000 (12:40 +0100)
core/js/js.js

index 9a7da67e71ff1477a93557789c3b9d34ec3d3cda..de24995ef130182878ff2d178947453f75c3bd8f 100644 (file)
@@ -628,7 +628,7 @@ $.fn.filterAttr = function(attr_name, attr_value) {
 function humanFileSize(size) {
        var humanList = ['B', 'kB', 'MB', 'GB', 'TB'];
        // Calculate Log with base 1024: size = 1024 ** order
-       var order = Math.floor(Math.log(size) / Math.log(1024));
+       var order = size?Math.floor(Math.log(size) / Math.log(1024)):0;
        // Stay in range of the byte sizes that are defined
        order = Math.min(humanList.length - 1, order);
        var readableFormat = humanList[order];