mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
bug fixes
This commit is contained in:
parent
251e3bf844
commit
d3ddcba313
@ -140,37 +140,39 @@ def scanupload(request, wallet=None):
|
|||||||
if dirs:
|
if dirs:
|
||||||
dirs = sorted(dirs)
|
dirs = sorted(dirs)
|
||||||
|
|
||||||
waldata = []
|
waldata = {}
|
||||||
if contents_path.is_file():
|
if contents_path.is_file():
|
||||||
with open(contents_path) as json_file:
|
with open(contents_path) as json_file:
|
||||||
try:
|
try:
|
||||||
waldata = json.load(json_file)
|
waldata = json.load(json_file)
|
||||||
except:
|
except:
|
||||||
message = f"! Failed to load {contents_path} JSON file"
|
message = f"! {wallet} Failed to load {contents_path} JSON file"
|
||||||
print(message)
|
print(message)
|
||||||
DataIssue.objects.create(parser='scans', message=message, url=wurl) # set URL to this wallet folder
|
DataIssue.objects.create(parser='scans', message=message, url=wurl) # set URL to this wallet folder
|
||||||
raise
|
raise
|
||||||
if not waldata["people"]:
|
|
||||||
waldata["people"]=["NOBODY"]
|
|
||||||
|
|
||||||
cave =""
|
cave =""
|
||||||
psg = ""
|
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,
|
context = {'year': year, 'prev': prev, 'next': next, 'prevy': prevy, 'nexty': nexty,
|
||||||
'files': files, 'dirs': dirs, 'waldata': waldata, 'create': create,
|
'files': files, 'dirs': dirs, 'waldata': waldata, 'create': create,
|
||||||
'filesaved': filesaved, 'actual_saved': actual_saved }
|
'filesaved': filesaved, 'actual_saved': actual_saved }
|
||||||
@ -226,6 +228,7 @@ def photoupload(request, folder=None):
|
|||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
f = request.FILES["uploadfiles"]
|
f = request.FILES["uploadfiles"]
|
||||||
multiple = request.FILES.getlist('uploadfiles')
|
multiple = request.FILES.getlist('uploadfiles')
|
||||||
|
# NO CHECK that the files being uploaded are image files
|
||||||
fs = FileSystemStorage(dirpath)
|
fs = FileSystemStorage(dirpath)
|
||||||
|
|
||||||
actual_saved = []
|
actual_saved = []
|
||||||
@ -279,7 +282,7 @@ def dwgupload(request, folder=None, gitdisable='no'):
|
|||||||
'''
|
'''
|
||||||
if name in [ '.gitignore', ]:
|
if name in [ '.gitignore', ]:
|
||||||
return False
|
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 True # dangerous, we should check the actual file binary signature
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user