fix survexfile bad filenames

This commit is contained in:
2025-12-16 20:36:01 +00:00
parent d17077aade
commit 0a2386f179

View File

@@ -756,7 +756,7 @@ def survexcavesingle(request, cave_shortname):
But might also be a link to a single survex file with no ".svx" suffix, which may not be a cave.
If cave_shortname=="" then it used to list all caves which did not have a kataser number,
an accident of coding. This now does not happen.
an accident of coding. This now does not happen because urls.py has been changed to stop it.
"""
if cave_shortname.startswith("caves-16"):
@@ -777,9 +777,14 @@ def survexcavesingle(request, cave_shortname):
# print(f"many {cave=} => {cave.sds=}")
return render(request, "svxcaves.html", {"settings": settings, "caves": caves, "year": current_expo()})
else:
# survex file not a cave, e.g. surface/1623/allsurface.svx
return svx(request, cave_shortname)
# return render(request, "errors/svxcaves404.html", {"settings": settings, "cave": cave_shortname, "year": current_expo()})
# A decision needs to be made: is this a silly thing or is it a real file?
filepath = settings.SURVEX_DATA / cave_shortname
if filepath.is_file():
print(filepath, type(filepath))
# survex file not a cave, e.g. surface/1623/allsurface.svx
return svx(request, cave_shortname)
else:
return render(request, "errors/svxcaves404.html", {"settings": settings, "cave": cave_shortname, "year": current_expo()})
def check_cave_registered(areacode, survex_cave):
"""Checks whether a cave has been properly registered when it is found in the Loser repo