From f874bdc55e9964ebcc13de15189c99942e5fe91e Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sat, 13 Jul 2024 14:51:19 +0200 Subject: [PATCH] fix --- core/views/uploads.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/core/views/uploads.py b/core/views/uploads.py index 9d0ed35..d3605b0 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -930,17 +930,21 @@ def gpxupload(request, folder=None): actual_saved.append(saved_filename) filesaved = True else: # multiple is a list of content - for f in multiple: - try: # crashes in Django os.chmod call if on WSL, but does save file! - saved_filename = fs.save(f.name, content=f) - except: - print( - f'\n !! Permissions failure ?! 3 attempting to save "{f.name}" in "{dirpath}" {renameto=}' - ) - if "saved_filename" in locals(): - if saved_filename.is_file(): - actual_saved.append(saved_filename) - filesaved = True + for f in multiple: + if gpxvalid(f.name): + try: # crashes in Django os.chmod call if on WSL, but does save file! + saved_filename = fs.save(f.name, content=f) + except: + print( + f'\n !! Permissions failure ?! 3 attempting to save "{f.name}" in "{dirpath}" {renameto=}' + ) + if "saved_filename" in locals(): + if saved_filename.is_file(): + actual_saved.append(saved_filename) + filesaved = True + else: + print(f"gpxupload(): not a GPX file {f.name=}") + print(f"gpxupload() drop through") files = [] dirs = []