Skip to content

Commit

Permalink
Adjust parsing regex for DeviceWifi to accomodate to multiple nmcli v…
Browse files Browse the repository at this point in the history
…ersions or locale adaptations. (Here just Mb/s instead of Mbit/s, so take both in account)
  • Loading branch information
chalios committed Sep 10, 2024
1 parent 55b8e5e commit 77e4207
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nmcli/data/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def parse(cls, text: str) -> DeviceWifi:
t = text.replace("\\:", "\uFFFE").replace(
":", "\uFFFF").replace("\uFFFE", ":")
m = re.search(
r'^(\*|\s)\uFFFF(.*)\uFFFF(.*)\uFFFF(.*)\uFFFF(\d+)\uFFFF(\d+)\sMHz\uFFFF(\d+)\sMbit\/s\uFFFF(\d+)\uFFFF(.*)$', t)
r'^(\*|\s)\uFFFF(.*)\uFFFF(.*)\uFFFF(.*)\uFFFF(\d+)\uFFFF(\d+)\sMHz\uFFFF(\d+)\s(?:Mb|Mbit)\/s\uFFFF(\d+)\uFFFF(.*)$', t)
if m:
in_use, ssid, bssid, mode, chan, freq, rate, signal, security = m.groups()
return DeviceWifi(in_use == '*', ssid, bssid, mode,
Expand Down

0 comments on commit 77e4207

Please sign in to comment.