mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Update device_handling.py
Fixes #1088 by sanitizing the inputs to mac, vendor, and name before running .upper/.lower to ensure they are type STR to avoid AttributeError
This commit is contained in:
@@ -674,9 +674,9 @@ def guess_icon(vendor, mac, ip, name, default):
|
||||
mylog('debug', [f"[guess_icon] Guessing icon for (vendor|mac|ip|name): ('{vendor}'|'{mac}'|{ip}|{name})"])
|
||||
|
||||
result = default
|
||||
mac = mac.upper()
|
||||
vendor = vendor.lower() if vendor else "unknown"
|
||||
name = name.lower() if name else "(unknown)"
|
||||
mac = str(mac).upper() if mac else "00:00:00:00:00:00"
|
||||
vendor = str(vendor).lower() if vendor else "unknown"
|
||||
name = str(name).lower() if name else "(unknown)"
|
||||
|
||||
# Guess icon based on vendor
|
||||
if any(brand in vendor for brand in {"samsung", "motorola"}):
|
||||
@@ -732,8 +732,8 @@ def guess_icon(vendor, mac, ip, name, default):
|
||||
# Guess device type
|
||||
def guess_type(vendor, mac, ip, name, default):
|
||||
result = default
|
||||
mac = mac.upper()
|
||||
vendor = vendor.lower() if vendor else "unknown"
|
||||
mac = str(mac).upper() if mac else "00:00:00:00:00:00"
|
||||
vendor = str(vendor).lower() if vendor else "unknown"
|
||||
name = str(name).lower() if name else "(unknown)"
|
||||
|
||||
# Guess icon based on vendor
|
||||
|
||||
Reference in New Issue
Block a user