1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

fix scope matching issue

This commit is contained in:
Kelly Brazil
2022-07-28 15:42:25 -07:00
parent 1fcf844e8d
commit 24960cd02b

View File

@ -545,12 +545,14 @@ def parse(
# python versions < 3.9 do not handle the ipv6 scope, so pop it
# and use instead of ipaddress.scope_id if parsing fails
scope_string = None
try:
interface = ipaddress.ip_interface(data)
except ValueError:
scope_match = re.match(SCOPE_PATTERN, data)
scope_match = re.search(SCOPE_PATTERN, data)
if scope_match:
scope_string = scope_match.group(0)
scope_string = scope_match.group(0)[1:]
data = re.sub(SCOPE_PATTERN, '', data)
interface = ipaddress.ip_interface(data)