Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/resources/fastpheno.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def get(self, tree_site_id):
tree_site_id = str(escape(tree_site_id))
site = request.args.get("site")

if not re.search(r"^[a-zA-Z0-9]{1,10}$", tree_site_id):
if not re.search(r"^[a-zA-Z0-9.]{1,15}$", tree_site_id):
return BARUtils.error_exit("Invalid tree site ID"), 400

if site is not None:
Expand Down Expand Up @@ -179,7 +179,7 @@ def get(self, tree_site_id, band):
band = str(escape(band))
site = request.args.get("site")

if not re.search(r"^[a-zA-Z0-9]{1,10}$", tree_site_id):
if not re.search(r"^[a-zA-Z0-9.]{1,15}$", tree_site_id):
return BARUtils.error_exit("Invalid tree site ID"), 400

if not re.search(r"^[a-zA-Z0-9_]{1,20}$", band):
Expand Down
8 changes: 4 additions & 4 deletions tests/resources/test_fastpheno.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ def test_get_trees(self):
expected = {"wasSuccessful": False, "error": "No data found for the given parameters"}
self.assertEqual(response.json, expected)

# Invalid tree_site_id (too long)
response = self.app_client.get("/fastpheno/get_trees/TOOLONGID12345")
# Invalid tree_site_id (contains disallowed character)
response = self.app_client.get("/fastpheno/get_trees/619!")
expected = {"wasSuccessful": False, "error": "Invalid tree site ID"}
self.assertEqual(response.json, expected)

Expand Down Expand Up @@ -231,8 +231,8 @@ def test_timeseries_genotype_aggregate(self):
expected = {"wasSuccessful": False, "error": "No data found for the given parameters"}
self.assertEqual(response.json, expected)

# Invalid tree_site_id (too long)
response = self.app_client.get("/fastpheno/timeseries/genotype/TOOLONGID123/398nm/aggregate")
# Invalid tree_site_id (contains disallowed character)
response = self.app_client.get("/fastpheno/timeseries/genotype/619!/398nm/aggregate")
expected = {"wasSuccessful": False, "error": "Invalid tree site ID"}
self.assertEqual(response.json, expected)

Expand Down
Loading