prevent IndexError if no GCP files

pull/1168/head
Tommy Ott 2022-04-18 12:04:57 -04:00
rodzic 5e31e343fd
commit b681608f83
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -1074,10 +1074,10 @@ class Task(models.Model):
:return: path to changed GCP file or None if no GCP file was found/changed
"""
gcp_path = self.find_all_files_matching(r'.*\.txt$')
if len(gcp_path) == 0: return None
# Skip geo.txt, image_groups.txt files
gcp_path = list(filter(lambda p: os.path.basename(p).lower() not in ['geo.txt', 'image_groups.txt'], gcp_path))
if len(gcp_path) == 0: return None
# Assume we only have a single GCP file per task
gcp_path = gcp_path[0]