Give a Not Found if the ship in question doesn't exist (or at least make a best effort to)

This commit is contained in:
Robert Miles 2021-10-13 10:35:28 +00:00
parent a4abb98cd9
commit 1cb30fb282
1 changed files with 1 additions and 0 deletions

1
app.py
View File

@ -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):