From d3026ac844d1d7eabbf434c28c1e5ea9a8918771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Mon, 9 Feb 2026 23:42:08 -0300 Subject: [PATCH] core: frontend: system-information: Fix negative bandwidth display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clamp network speed calculations to zero to prevent negative bandwidth values when interface counters reset or wrap around. Closes #3587 Signed-off-by: Patrick José Pereira --- core/frontend/src/store/system-information.ts | 4 ++-- core/frontend/src/utils/networking.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/frontend/src/store/system-information.ts b/core/frontend/src/store/system-information.ts index c3e98efb10..c5f148647e 100644 --- a/core/frontend/src/store/system-information.ts +++ b/core/frontend/src/store/system-information.ts @@ -182,8 +182,8 @@ class SystemInformationStore extends VuexModule { const dt = (now - (previousNetwork?.last_update ?? 5)) / 1000 network.last_update = now if (previousNetwork) { - network.download_speed = (network.total_received_B - previousNetwork.total_received_B) / dt - network.upload_speed = (network.total_transmitted_B - previousNetwork.total_transmitted_B) / dt + network.download_speed = Math.max(0, (network.total_received_B - previousNetwork.total_received_B) / dt) + network.upload_speed = Math.max(0, (network.total_transmitted_B - previousNetwork.total_transmitted_B) / dt) } } this.system.network = networks diff --git a/core/frontend/src/utils/networking.ts b/core/frontend/src/utils/networking.ts index d5f271696e..631d678547 100644 --- a/core/frontend/src/utils/networking.ts +++ b/core/frontend/src/utils/networking.ts @@ -1,5 +1,5 @@ export function formatBandwidth(bytesPerSecond: number): string { - const mbps = (8 * bytesPerSecond / 1024 / 1024) + const mbps = (8 * Math.max(0, bytesPerSecond) / 1024 / 1024) const decimal_places = mbps < 10 ? 2 : mbps < 100 ? 1 : 0 return `${mbps.toFixed(decimal_places)}Mbps` }