aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/storage-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-11-07 09:58:46 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-11-25 10:34:23 -0500
commit614b428570a8bb5a964a92ae733e2b50e4d8bf51 (patch)
tree3665209149d0b1bc460d4d036ab6404d831c25d9 /ext/bg/js/settings/storage-controller.js
parent838175f06baca9503dca4180b01853a0a2afd734 (diff)
Fix byte count labels (#998)
* Add 'TB' label * Prevent overflow * Fix storage information on the old settings page
Diffstat (limited to 'ext/bg/js/settings/storage-controller.js')
-rw-r--r--ext/bg/js/settings/storage-controller.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/bg/js/settings/storage-controller.js b/ext/bg/js/settings/storage-controller.js
index bc57017f..32b98304 100644
--- a/ext/bg/js/settings/storage-controller.js
+++ b/ext/bg/js/settings/storage-controller.js
@@ -148,9 +148,10 @@ class StorageController {
_bytesToLabeledString(size) {
const base = 1000;
- const labels = [' bytes', 'KB', 'MB', 'GB'];
+ const labels = [' bytes', 'KB', 'MB', 'GB', 'TB'];
+ const maxLabelIndex = labels.length - 1;
let labelIndex = 0;
- while (size >= base) {
+ while (size >= base && labelIndex < maxLabelIndex) {
size /= base;
++labelIndex;
}