Skip to content

Commit

Permalink
raise and check nesting depth
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Aug 16, 2022
1 parent 0b9351e commit 09509f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mpcontribs-api/mpcontribs/api/__init__.py
Expand Up @@ -30,7 +30,7 @@
from requests.exceptions import ConnectionError


delimiter, max_depth = ".", 4
delimiter, max_depth = ".", 7 # = MAX_NESTING + 2 from client
invalidChars = set(punctuation.replace("*", ""))
invalidChars.add(" ")
is_gunicorn = "gunicorn" in os.environ.get("SERVER_SOFTWARE", "")
Expand Down
5 changes: 3 additions & 2 deletions mpcontribs-client/mpcontribs/client/__init__.py
Expand Up @@ -58,6 +58,7 @@
RETRIES = 3
MAX_WORKERS = 8
MAX_ELEMS = 10
MAX_NESTING = 5
MEGABYTES = 1024 * 1024
MAX_BYTES = 2.4 * MEGABYTES
MAX_PAYLOAD = 15 * MEGABYTES
Expand Down Expand Up @@ -911,8 +912,8 @@ def init_columns(self, columns: dict = None) -> dict:
continue

nesting = k.count(".")
if nesting > 4:
return {"error": f"Nesting too deep for {k}"}
if nesting > MAX_NESTING:
return {"error": f"Nesting depth larger than {MAX_NESTING} for {k}!"}

for col in scanned_columns:
if nesting and col.startswith(k):
Expand Down

0 comments on commit 09509f4

Please sign in to comment.