Retain last two chars for children device_id (#733)

This commit is contained in:
Teemu R
2024-02-01 19:27:01 +01:00
committed by GitHub
parent 8657959ace
commit 1acf4e86da
3 changed files with 25 additions and 29 deletions

View File

@@ -60,6 +60,7 @@ def scrub(res):
"alias",
"bssid",
"channel",
"original_device_id", # for child devices
]
for k, v in res.items():
@@ -96,6 +97,11 @@ def scrub(res):
v = "#MASKED_NAME#"
elif isinstance(res[k], int):
v = 0
elif k == "device_id" and len(v) > 40:
# retain the last two chars when scrubbing child ids
end = v[-2:]
v = re.sub(r"\w", "0", v)
v = v[:40] + end
else:
v = re.sub(r"\w", "0", v)