File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5+ import os
56import re
67import uuid
78import warnings
@@ -326,11 +327,17 @@ def _parse_local_dir_path(path_str: str) -> IngestionQuery:
326327 IngestionQuery
327328 A dictionary containing the parsed details of the file path.
328329
330+ Raises
331+ ------
332+ InvalidPatternError
333+ If the path escapes the allowed root directory.
334+
329335 """
330336 root_path = TMP_BASE_PATH .resolve ()
331337 path_obj = Path (path_str ).resolve ()
332338 if os .path .commonpath ([root_path , path_obj ]) != str (root_path ):
333- raise InvalidPatternError (f"Path { path_str } escapes the allowed root directory." )
339+ msg = f"Path { path_str } escapes the allowed root directory."
340+ raise InvalidPatternError (msg )
334341 slug = path_obj .name if path_str == "." else path_str .strip ("/" )
335342 return IngestionQuery (local_path = path_obj , slug = slug , id = str (uuid .uuid4 ()))
336343
You can’t perform that action at this time.
0 commit comments