Skip to content

Commit

Permalink
Display file size of empty files correctly
Browse files Browse the repository at this point in the history
Resolves kartik-v#894

0.00 B display is consistent with display of a one byte file (1.00 B) as per the general logic.
  • Loading branch information
pjetherton authored Mar 6, 2017
1 parent 20ca9e6 commit e29f3f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/fileinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -2194,6 +2194,8 @@
}
if (typeof func === 'function') {
out = func(size);
} else if (size === 0) {
out = '0.00 B';
} else {
i = Math.floor(Math.log(size) / Math.log(1024));
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
Expand Down Expand Up @@ -3529,4 +3531,4 @@
$input.fileinput();
}
});
}));
}));

0 comments on commit e29f3f7

Please sign in to comment.