fix: harden endpoints against malformed input (final-review findings)
- /api/repeaters: bad ?limit= falls back to 25 instead of crashing the handler
- repeaters.load(): tolerate a corrupted repeaters.json (JSONDecodeError -> [])
- tune_repeater/do_POST: catch TypeError so a null field yields {ok:false} not a reset
This commit is contained in:
+1
-1
@@ -72,7 +72,7 @@ def load(path):
|
||||
try:
|
||||
with open(path) as f:
|
||||
data = json.load(f)
|
||||
except FileNotFoundError:
|
||||
except (FileNotFoundError, json.JSONDecodeError):
|
||||
return []
|
||||
return data if isinstance(data, list) else data.get("repeaters", [])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user