Skip to content

Commit

Permalink
Update validators.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxin688 committed Jul 25, 2024
1 parent 1ff1d86 commit 1724148
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backend/src/core/utils/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def mac_address_validator(mac: str) -> str:
"""
_mac_address_re = r"^[0-9a-fA-F]{12}$"
input_mac = re.sub(r"[^0-9a-fA-F]", "", mac)
if len(mac) != MAC_ADDRESS_LENGTH:
if len(input_mac) != MAC_ADDRESS_LENGTH:
raise ValueError("validation_error.bad_mac_format")
if re.match(_mac_address_re, input_mac):
return ":".join(input_mac[i : i + 2] for i in range(0, len(input_mac), 2)).lower()
Expand Down

0 comments on commit 1724148

Please sign in to comment.