diff --git a/hwmonDaemon.py b/hwmonDaemon.py index f60d0b7..e487e66 100644 --- a/hwmonDaemon.py +++ b/hwmonDaemon.py @@ -785,20 +785,19 @@ class SystemHealthMonitor: size_str = size_str.strip().upper() - match = re.match(r'^([\d.]+)\s*([KMGT])?B?$', size_str) # Corrected regex + match = re.match(r'^([\d.]+)\s*([KMGT])B?$', size_str) if match: value = float(match.group(1)) - unit = match.group(2) if match.group(2) else 'B' + unit = match.group(2) multipliers = { - 'B': 1, 'K': 1024, 'M': 1024**2, 'G': 1024**3, 'T': 1024**4 } - return value * multipliers[unit] + return value * multipliers.get(unit, 1) # Default to 1 for bytes return 0.0