We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 44957cd commit 5b72682Copy full SHA for 5b72682
1 file changed
synapseclient/extensions/curator/utils.py
@@ -2,6 +2,9 @@
2
from synapseclient.models import Project
3
from synapseclient.operations import get
4
5
+"""This number represents a safeguard against infinite loops when traversing the folder hierarchy to find the project ID."""
6
+MAX_HIERARCHY_DEPTH = 1000
7
+
8
9
def project_id_from_entity_id(entity_id: str, synapse_client: Synapse) -> str:
10
"""
@@ -24,6 +27,6 @@ def project_id_from_entity_id(entity_id: str, synapse_client: Synapse) -> str:
24
27
while not isinstance(current_obj, Project):
25
28
current_obj = get(current_obj.parent_id, synapse_client=synapse_client)
26
29
iterations += 1
- if iterations > 1000:
30
+ if iterations > MAX_HIERARCHY_DEPTH:
31
raise ValueError("Could not find project ID in folder hierarchy")
32
return current_obj.id
0 commit comments