Fixed off by one bug. List length is 1 larger than the index of the last
element.
This commit is contained in:
parent
aae0d990ca
commit
2a351f4456
|
@ -455,7 +455,7 @@ function humanFileSize(size) {
|
|||
// Calculate Log with base 1024: size = 1024 ** order
|
||||
order = Math.floor(Math.log(size) / Math.log(1024));
|
||||
// Stay in range of the byte sizes that are defined
|
||||
order = Math.min(humanList.length, order);
|
||||
order = Math.min(humanList.length - 1, order);
|
||||
readableFormat = humanList[order];
|
||||
relativeSize = (size / Math.pow(1024, order)).toFixed(1);
|
||||
if(relativeSize.substr(relativeSize.length-2,2)=='.0'){
|
||||
|
|
Loading…
Reference in New Issue