[pve-devel] [PATCH widget-toolkit 2/2] utils: format_size: show negative size as NA

Aaron Lauterer a.lauterer at proxmox.com
Wed Apr 19 12:34:39 CEST 2023


Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---

AFAIK we do not have negative sizes anywhere, and if, it is an
indication that something is wrong.

 src/Utils.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/Utils.js b/src/Utils.js
index ef72630..8cdbe86 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -688,6 +688,9 @@ utilities: {
     },
 
     format_size: function(size, useSI) {
+	if (size < 0) {
+	    return gettext("N/A");
+	}
 	let units = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
 	let order = 0;
 	const baseValue = useSI ? 1000 : 1024;
-- 
2.30.2






More information about the pve-devel mailing list