From 704ffc274227a440e7e458fce92f2b67c32f0c06 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 14 Apr 2022 20:03:19 -0400 Subject: [PATCH] Fix file unzip --- app/classes/shared/helpers.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py index caf6438b..dfacd362 100644 --- a/app/classes/shared/helpers.py +++ b/app/classes/shared/helpers.py @@ -443,13 +443,24 @@ class Helpers: full_root_path = temp_dir for item in os.listdir(full_root_path): - try: - FileHelpers.move_dir( - os.path.join(full_root_path, item), - os.path.join(new_dir, item), - ) - except Exception as ex: - logger.error(f"ERROR IN ZIP IMPORT: {ex}") + print(item) + if os.path.isdir(os.path.join(full_root_path, item)): + print("dir") + try: + FileHelpers.move_dir( + os.path.join(full_root_path, item), + os.path.join(new_dir, item), + ) + except Exception as ex: + logger.error(f"ERROR IN ZIP IMPORT: {ex}") + else: + try: + FileHelpers.move_file( + os.path.join(full_root_path, item), + os.path.join(new_dir, item), + ) + except Exception as ex: + logger.error(f"ERROR IN ZIP IMPORT: {ex}") except Exception as ex: print(ex) else: