From 9dbdb5200a87677ab754f6f1bd050388f1022518 Mon Sep 17 00:00:00 2001 From: drunkendog Date: Mon, 25 Sep 2023 20:42:33 +0100 Subject: [PATCH] Add additional 404 handling for when branch and action are not in dictionary --- api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api.py b/api.py index 25efb4f..eaab017 100644 --- a/api.py +++ b/api.py @@ -49,7 +49,12 @@ async def set_badge(repo: str, new_badge: str, branch: str=None, action: str=Non @app.get("/get_badge/") async def get_badge(repo: str, branch: str=None, action: str=None): - if repo not in badge_dict.keys(): + if branch is None and action is None and repo not in badge_dict.keys(): + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail="Repo not found", + ) + elif (repo, branch, action) not in badge_dict.keys(): raise HTTPException( status_code=status.HTTP_404_NOT_FOUND, detail="Repo not found",