diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2024-12-19 22:55:08 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2024-12-19 22:55:08 +0000 |
commit | 011e6777c9cf092bdcb8b5d9bfda8a0b86c69236 (patch) | |
tree | 474dfe0908531d1cc22f14024cfa375f5c28c072 /core/views/expo.py | |
parent | 19bbb00dcc9d8fc2600bd782343ffff2a9fb2798 (diff) | |
download | troggle-011e6777c9cf092bdcb8b5d9bfda8a0b86c69236.tar.gz troggle-011e6777c9cf092bdcb8b5d9bfda8a0b86c69236.tar.bz2 troggle-011e6777c9cf092bdcb8b5d9bfda8a0b86c69236.zip |
bugfixes and more comments
Diffstat (limited to 'core/views/expo.py')
-rw-r--r-- | core/views/expo.py | 10 |
1 files changed, 8 insertions, 2 deletions
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): |