Am 19/04/2023 um 12:34 schrieb Aaron Lauterer:
> Signed-off-by: Aaron Lauterer <a.laute...@proxmox.com>
> ---
> 
> AFAIK we do not have negative sizes anywhere, and if, it is an
> indication that something is wrong.

above belongs in the commit message, additionaly some background for why doing
this now (i.e., did you run into this or what made you make this change?)

> 
>  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");

catching this seems OK, but I'd rather just return the value then, as "N/A" (Not
Applicable) doesn't really makes sense here and just hides a potential 
underlying
problem.

> +     }
>       let units = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
>       let order = 0;
>       const baseValue = useSI ? 1000 : 1024;



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to