diff --git a/monkey/common/agent_configuration/validators/filenames.py b/monkey/common/agent_configuration/validators/filenames.py index 897fa2f13..2a8e4df01 100644 --- a/monkey/common/agent_configuration/validators/filenames.py +++ b/monkey/common/agent_configuration/validators/filenames.py @@ -13,12 +13,12 @@ def validate_linux_filename(linux_filename: str): def validate_windows_filename(windows_filename: str): - validate_windows_filename_not_reserved(windows_filename) + _validate_windows_filename_not_reserved(windows_filename) if not re.match(_valid_windows_filename_regex, windows_filename): raise ValidationError(f"Invalid Windows filename {windows_filename}: illegal characters") -def validate_windows_filename_not_reserved(windows_filename: str): +def _validate_windows_filename_not_reserved(windows_filename: str): # filename shouldn't start with any of these and be followed by a period if PureWindowsPath(windows_filename).is_reserved(): raise ValidationError(f"Invalid Windows filename {windows_filename}: reserved name used") diff --git a/monkey/common/agent_configuration/validators/ip_ranges.py b/monkey/common/agent_configuration/validators/ip_ranges.py index 5fca61b3d..6eabc9e61 100644 --- a/monkey/common/agent_configuration/validators/ip_ranges.py +++ b/monkey/common/agent_configuration/validators/ip_ranges.py @@ -52,15 +52,12 @@ def validate_ip_network(ip_network: str): def validate_ip_range(ip_range: str): - try: - ip_range = ip_range.replace(" ", "") - ips = ip_range.split("-") - if len(ips) != 2: - raise ValidationError(f"Invalid IP range {ip_range}") - validate_ip(ips[0]) - validate_ip(ips[1]) - except IndexError: + ip_range = ip_range.replace(" ", "") + ips = ip_range.split("-") + if len(ips) != 2: raise ValidationError(f"Invalid IP range {ip_range}") + validate_ip(ips[0]) + validate_ip(ips[1]) def validate_ip(ip: str):