Spaces:
Running
Running
Update ipmentor/tools.py
Browse files- ipmentor/tools.py +7 -1
ipmentor/tools.py
CHANGED
|
@@ -300,7 +300,13 @@ def subnet_calculator(network: str, number: str = "0", division_type: str = "max
|
|
| 300 |
str: Calculated subnet information in JSON format
|
| 301 |
"""
|
| 302 |
try:
|
| 303 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
result = calculate_subnets(
|
| 305 |
network.strip(),
|
| 306 |
number_int,
|
|
|
|
| 300 |
str: Calculated subnet information in JSON format
|
| 301 |
"""
|
| 302 |
try:
|
| 303 |
+
# Handle empty number parameter (especially for VLSM)
|
| 304 |
+
number_str = number.strip()
|
| 305 |
+
if number_str == "":
|
| 306 |
+
number_int = 0 # Use 0 as default when number is not provided
|
| 307 |
+
else:
|
| 308 |
+
number_int = int(number_str)
|
| 309 |
+
|
| 310 |
result = calculate_subnets(
|
| 311 |
network.strip(),
|
| 312 |
number_int,
|