Skip to content

Commit c18384c

Browse files
committed
remove unsed tor_dir; handle FileNotFoundError; raise HTTPException on unhappy path
1 parent 0c8a786 commit c18384c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ooniapi/services/ooniprobe/src/ooniprobe/routers/v1/probe_services.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,6 @@ def list_tor_targets(
606606
settings: Settings = Depends(get_settings),
607607
) -> Dict[str, TorTarget]:
608608

609-
tor_dir = settings.tor_targets
610609
token = request.headers.get("Authorization")
611610
if token == None:
612611
# XXX not actually validated
@@ -617,4 +616,6 @@ def list_tor_targets(
617616
return resp
618617
except ujson.JSONDecodeError:
619618
log.info("tor-targets: failed to parse json")
620-
raise HTTPException(status_code=401, detail="Invalid tor-targets")
619+
except FileNotFoundError
620+
log.info("tor-targets: failed to open json")
621+
raise HTTPException(status_code=401, detail="Invalid tor-targets")

0 commit comments

Comments
 (0)