From 1cb30fb282bcf33d874ba1b23245ccd7482cbc6f Mon Sep 17 00:00:00 2001 From: khuxkm fbexl Date: Wed, 13 Oct 2021 10:35:28 +0000 Subject: [PATCH] Give a Not Found if the ship in question doesn't exist (or at least make a best effort to) --- app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app.py b/app.py index 3855d4f..b68fb64 100644 --- a/app.py +++ b/app.py @@ -157,6 +157,7 @@ def ships(request): def ship(request,ship=None): if ship is None: return Response(Status.BAD_REQUEST,"Bad Request") ship_unquoted = urllib.parse.unquote(ship) + if not os.path.isdir(os.path.join("/var/gopher",ship_unquoted)): return Response(Status.NOT_FOUND,"Not Found") def __generator(): description = os.path.join("/var/gopher",ship_unquoted,".description") if os.path.exists(description):