diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2022-03-05 20:29:01 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2022-03-05 20:29:01 +0000 |
commit | a3a65524b86abde3bc924d611620f71f87b7bf36 (patch) | |
tree | 6b9edfa909a242792417059b3e50af9df583711f /core/views/uploads.py | |
parent | 88f5df0f19a1b9d16e0b92dcd910f6bd7db9e2b9 (diff) | |
download | troggle-a3a65524b86abde3bc924d611620f71f87b7bf36.tar.gz troggle-a3a65524b86abde3bc924d611620f71f87b7bf36.tar.bz2 troggle-a3a65524b86abde3bc924d611620f71f87b7bf36.zip |
better errors for drawings parsing & upload
Diffstat (limited to 'core/views/uploads.py')
-rw-r--r-- | core/views/uploads.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/views/uploads.py b/core/views/uploads.py index 2f3e053..6819e3d 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -109,12 +109,12 @@ def dwgupload(request, folder=None, gitdisable='no'): We use get_or_create instead of simply creating a new object in case someone uploads the same file several times in one session, and expects them to be overwritten in the database. Although - the actual file will be duplicated in the filesystem with different random name ammendation. + the actual file will be duplicated in the filesystem with different random name ending. ''' def dwgvalid(name): - if name in [ '.gitignore', '.hgignore', ]: + if name in [ '.gitignore', ]: return False - if Path(name).suffix.lower() in ['.xml', '.th', '.th2', '', '.svg', '.jpg', '.pdf', 'jpeg']: + if Path(name).suffix.lower() in ['.xml', '.th', '.th2', '', '.svg', '.jpg', '.pdf', '.jpeg', '.txt']: return True # dangerous, we should check the actual file binary signature return False @@ -163,10 +163,11 @@ def dwgupload(request, folder=None, gitdisable='no'): dwgfile.save() else: refused.append(f.name) + print(f'REFUSED {f.name}') if actual_saved: # maybe all were refused by the suffix test in dwgvalid() filesaved = True if gitdisable != 'yes': - subprocess.call([git, "commit", "-m", 'dwgupload'], cwd=dirpath) + subprocess.call([git, "commit", "-m", f'Drawings upload - {list(multiple)}'], cwd=dirpath) files = [] |