mirror of
https://github.com/cdr/code-server.git
synced 2026-01-21 07:34:08 +01:00
Fix human readable byte size when zero
This commit is contained in:
parent
0462a93f11
commit
4a29cd1664
1 changed files with 2 additions and 3 deletions
|
|
@ -505,9 +505,8 @@ class DialogEntryRenderer implements ITreeRenderer<DialogEntry, string, DialogEn
|
|||
*/
|
||||
private humanReadableSize(bytes: number): string {
|
||||
const units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
||||
const i = Math.min(Math.floor(Math.log(bytes) / Math.log(1000)), units.length - 1);
|
||||
const i = Math.min(Math.floor(bytes && Math.log(bytes) / Math.log(1000)), units.length - 1);
|
||||
|
||||
return (bytes / Math.pow(1000, i)).toFixed(2)
|
||||
+ " " + units[i];
|
||||
return (bytes / Math.pow(1000, i)).toFixed(2) + " " + units[i];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue