From 011e6777c9cf092bdcb8b5d9bfda8a0b86c69236 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Thu, 19 Dec 2024 22:55:08 +0000 Subject: bugfixes and more comments --- core/views/expo.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'core/views/expo.py') diff --git a/core/views/expo.py b/core/views/expo.py index b2ab312..bf9e78d 100644 --- a/core/views/expo.py +++ b/core/views/expo.py @@ -71,8 +71,14 @@ def map(request): def mapfile(request, path): """Serves unadorned file: everything in the /map/... folder tree""" fn = Path(settings.EXPOWEB, "map", path) - print(f"MAP cuttout. \n{path=}\n{fn=} mime:{getmimetype(fn)}") - return HttpResponse(content=open(fn, "r"), content_type=getmimetype(fn)) + if fn.is_file(): + print(f"MAP cuttout. \n{path=}\n{fn=} mime:{getmimetype(fn)}") + return HttpResponse(content=open(fn, "r"), content_type=getmimetype(fn)) + else: + message = f"### File not found ### {fn}" + print(message) + return render(request, "errors/generic.html", {"message": message}) + def expofilessingle(request, filepath): -- cgit v1.2.3