From 8c96b50833bc2ec2c953f2e0620b40ddc85c1b9d Mon Sep 17 00:00:00 2001
From: Bryan Brancotte <bryan.brancotte@pasteur.fr>
Date: Mon, 30 Oct 2023 20:48:58 +0100
Subject: [PATCH] only return initTables that have a valide filename

---
 jass/server.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/jass/server.py b/jass/server.py
index 12473e65..262b859c 100644
--- a/jass/server.py
+++ b/jass/server.py
@@ -13,7 +13,7 @@ from tables import HDF5ExtError
 from jass import util
 from jass.config import config
 from jass.models.phenotype import Phenotype, get_available_phenotypes, PhenotypeIdList, InitTableNameModel
-from jass.models.inittable import get_inittable_meta
+from jass.models.inittable import get_inittable_meta, valideInitTableNamePattern
 from jass.models.project import GlobalProject, load_project as project__load_project
 from jass.tasks import create_project, run_project_analysis_if_needed, get_queue_status
 
@@ -56,7 +56,11 @@ async def read_index():
 def inittable_list():
     """List initTables"""
     for filename in os.listdir(config["DATA_DIR"]):
-        if filename.endswith(".hdf5") and "worktable" not in filename:
+        if (
+            filename.endswith(".hdf5")
+            and "worktable" not in filename
+            and valideInitTableNamePattern.match(filename)
+        ):
             yield filename
 
 
-- 
GitLab