2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

bug fixes

This commit is contained in:
Philip Sargent 2022-03-15 23:00:23 +00:00
parent 251e3bf844
commit d3ddcba313

View File

@ -140,37 +140,39 @@ def scanupload(request, wallet=None):
if dirs:
dirs = sorted(dirs)
waldata = []
waldata = {}
if contents_path.is_file():
with open(contents_path) as json_file:
try:
waldata = json.load(json_file)
except:
message = f"! Failed to load {contents_path} JSON file"
message = f"! {wallet} Failed to load {contents_path} JSON file"
print(message)
DataIssue.objects.create(parser='scans', message=message, url=wurl) # set URL to this wallet folder
raise
if not waldata["people"]:
waldata["people"]=["NOBODY"]
cave =""
psg = ""
if waldata["cave"]:
cave = waldata["cave"]
if waldata["name"]:
psg = waldata["name"]
if waldata["survex file"]:
if not isinstance(waldata["survex file"], list):
waldata["survex file"] = [waldata["survex file"]]
for svx in waldata["survex file"]:
print(f'{svx}')
if not (Path(settings.SURVEX_DATA) / svx).is_file():
message = f"! Incorrect survex file in wallet data: {svx} not found in LOSER repo"
print(message)
DataIssue.objects.create(parser='scans', message=message, url=wurl) # set URL to this wallet folder
if waldata:
if not waldata["people"]:
waldata["people"]=["NOBODY"]
if waldata["cave"]:
cave = waldata["cave"]
if waldata["name"]:
psg = waldata["name"]
if waldata["survex file"]:
if not isinstance(waldata["survex file"], list):
waldata["survex file"] = [waldata["survex file"]]
for svx in waldata["survex file"]:
print(f'{svx}')
if not (Path(settings.SURVEX_DATA) / svx).is_file():
message = f"! {wallet} Incorrect survex file in wallet data: {svx} not found in LOSER repo"
print(message)
DataIssue.objects.create(parser='scans', message=message, url=wurl) # set URL to this wallet folder
context = {'year': year, 'prev': prev, 'next': next, 'prevy': prevy, 'nexty': nexty,
'files': files, 'dirs': dirs, 'waldata': waldata, 'create': create,
'filesaved': filesaved, 'actual_saved': actual_saved }
@ -226,6 +228,7 @@ def photoupload(request, folder=None):
if form.is_valid():
f = request.FILES["uploadfiles"]
multiple = request.FILES.getlist('uploadfiles')
# NO CHECK that the files being uploaded are image files
fs = FileSystemStorage(dirpath)
actual_saved = []
@ -279,7 +282,7 @@ def dwgupload(request, folder=None, gitdisable='no'):
'''
if name in [ '.gitignore', ]:
return False
if Path(name).suffix.lower() in ['.xml', '.th', '.th2', '', '.svg', '.txt', '.jpg', '.jpeg', '.png', '.pdf', '.topo']:
if Path(name).suffix.lower() in ['.xml', '.th', '.th2', '', '.svg', '.txt', '.jpg', '.jpeg', '.png', '.pdf', '.top', '.topo']:
return True # dangerous, we should check the actual file binary signature
return False