Skip to content

Commit

Permalink
Fix bug in get_size on sizes less than 1MiB
Browse files Browse the repository at this point in the history
  • Loading branch information
itismadness committed Aug 20, 2021
1 parent a82e2c1 commit 62577ca
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions public/static/functions/script_start.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ function html_entity_decode(str) {

function get_size(size) {
var steps = 0;
while (size >= 1024) {
while (steps < 8 && size >= 1024) {
steps++;
size = size / 1024;
}
var ext;
switch (steps) {
case 1: ext = ' B';
case 0: ext = ' B';
break;
case 1: ext = ' KiB';
break;
Expand All @@ -108,7 +108,6 @@ function get_size(size) {
break;
case 8: ext = ' YiB';
break;
default: "0.00 MiB";
}
return (size.toFixed(2) + ext);
}
Expand Down

0 comments on commit 62577ca

Please sign in to comment.