Fix: file sizes below 0.1 MiB are shown as "0 MiB" on releases page

If the size of a file is less than 0.1 MiB, display its size in KiB.

Change-Id: I9869251ccc7f1e356371fa46e682fce74edb805b
This commit is contained in:
David Pursehouse 2013-06-24 19:10:18 +09:00
parent e348f21ef7
commit e75106a1d0
1 changed files with 6 additions and 2 deletions

View File

@ -111,8 +111,12 @@ function(data) {
td = doc.createElement('td');
td.className = 'size';
td.appendChild(doc.createTextNode(
Math.round(f.size/(1024*1024)*10)/10 + ' MiB'));
if (f.size/(1024*1024) < 1) {
sizeText = Math.round(f.size/1024*10)/10 + ' KiB';
} else {
sizeText = Math.round(f.size/(1024*1024)*10)/10 + ' MiB';
}
td.appendChild(doc.createTextNode(sizeText));
tr.appendChild(td);
frg.appendChild(tr);