Skip to content

Commit

Permalink
improved slice regex pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperrealist authored and danielballan committed Jun 18, 2024
1 parent f033e49 commit 4c2a539
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tiled/server/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
# saving slice() to rescue after using "slice" for FastAPI dependency injection of slice_(slice: str)
slice_func = slice

DIM_REGEX = r"(?:(?:-?\d+)?:){0,2}(?:-?\d+)?"
SLICE_REGEX = rf"^{DIM_REGEX}(?:,{DIM_REGEX})*$"


@lru_cache(1)
def get_query_registry():
Expand Down Expand Up @@ -163,7 +166,7 @@ def expected_shape(


def slice_(
slice: Optional[str] = None,
slice: str = Query(None, pattern=SLICE_REGEX),
):
"Specify and parse a block index parameter."

Expand Down

0 comments on commit 4c2a539

Please sign in to comment.