1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Prevent mismatch of cases in ranges

This commit is contained in:
Ryan Breaker
2017-10-24 19:46:12 -05:00
parent b295849f53
commit 3df7e283e3

View File

@ -87,8 +87,11 @@ def parse_alphanumeric_range(string):
for dash_range in string.split(','):
try:
begin, end = dash_range.split('-')
# Skip if incompatible types or mixed case, just like any other bad pattern
if (str.isalpha(begin) and str.isdigit(end)) or (str.isdigit(begin) and str.isalpha(end)):
continue # Skip if it's invalid, just like any other bad pattern
continue
if not (str.isupper(begin + end) or str.islower(begin + end)):
continue
except ValueError:
begin, end = dash_range, dash_range
nums = list(range(ord(begin), ord(end)+1))