mirror of https://git.tuxpa.in/a/code-server.git
Fix human readable byte size when zero
This commit is contained in:
parent
0462a93f11
commit
4a29cd1664
|
@ -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 New Issue