MCPcopy Create free account
hub / github.com/nodejs/node / split_template_path

Function split_template_path

deps/v8/third_party/jinja2/loaders.py:25–39  ·  view source on GitHub ↗

Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error.

(template: str)

Source from the content-addressed store, hash-verified

23
24
25def split_template_path(template: str) -> t.List[str]:
26 """Split a path into segments and perform a sanity check. If it detects
27 '..' in the path it will raise a `TemplateNotFound` error.
28 """
29 pieces = []
30 for piece in template.split("/"):
31 if (
32 os.path.sep in piece
33 or (os.path.altsep and os.path.altsep in piece)
34 or piece == os.path.pardir
35 ):
36 raise TemplateNotFound(template)
37 elif piece and piece != ".":
38 pieces.append(piece)
39 return pieces
40
41
42class BaseLoader:

Callers 2

get_sourceMethod · 0.70
get_sourceMethod · 0.70

Calls 3

TemplateNotFoundClass · 0.70
splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected