Skip to content

Commit 4a29cd1

Browse files
committed
Fix human readable byte size when zero
1 parent 0462a93 commit 4a29cd1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/vscode/src/dialog.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,8 @@ class DialogEntryRenderer implements ITreeRenderer<DialogEntry, string, DialogEn
505505
*/
506506
private humanReadableSize(bytes: number): string {
507507
const units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
508-
const i = Math.min(Math.floor(Math.log(bytes) / Math.log(1000)), units.length - 1);
508+
const i = Math.min(Math.floor(bytes && Math.log(bytes) / Math.log(1000)), units.length - 1);
509509

510-
return (bytes / Math.pow(1000, i)).toFixed(2)
511-
+ " " + units[i];
510+
return (bytes / Math.pow(1000, i)).toFixed(2) + " " + units[i];
512511
}
513512
}

0 commit comments

Comments
 (0)