From 9c16bc78540aa412a574d65e7aea747ee7a6844d Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Sat, 17 May 2025 14:34:16 -0400 Subject: [PATCH] More idiomatic string check --- app/models/task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/task.py b/app/models/task.py index 6293df47..acc83f8d 100644 --- a/app/models/task.py +++ b/app/models/task.py @@ -987,7 +987,7 @@ class Task(models.Model): # Check if the zip file contained a top level directory # which shouldn't be there and try to fix the structure top_level = [os.path.join(assets_dir, d) for d in os.listdir(assets_dir)] - if len(top_level) == 1 and os.path.isdir(top_level[0]) and top_level[0][-14:] != "odm_orthophoto": + if len(top_level) == 1 and os.path.isdir(top_level[0]) and (not top_level[0].endswith("odm_orthophoto")): second_level = [os.path.join(top_level[0], f) for f in os.listdir(top_level[0])] if len(second_level) > 0: logger.info("Top level directory found in imported archive, attempting to fix")