Path 1: 16 calls (1.0)

'/Users/andrehora/Documents/git/projects-pathspotter/flask/tests/static' (10) '/Users/andrehora/Documents/git/projects-pathspotter/flask/tests/test_ap...

'index.html' (9) 'static/index.html' (2) 'css/test.css' (2) 'test.txt' (1) FakePath (1) 'hello.txt' (1)

{'max_age': None} (10) {'max_age': 3600} (3) {'max_age': 100} (1) {'max_age': 10} (1) {} (1)

Response (16)

1def send_from_directory(
2    directory: os.PathLike | str,
3    path: os.PathLike | str,
4    **kwargs: t.Any,
5) -> Response:
6    """Send a file from within a directory using :func:`send_file`.
7
8    .. code-block:: python
9
10        @app.route("/uploads/<path:name>")
11        def download_file(name):
12            return send_from_directory(
13                app.config['UPLOAD_FOLDER'], name, as_attachment=True
14            )
15
16    This is a secure way to serve files from a folder, such as static
17    files or uploads. Uses :func:`~werkzeug.security.safe_join` to
18    ensure the path coming from the client is not maliciously crafted to
19    point outside the specified directory.
20
21    If the final path does not point to an existing regular file,
22    raises a 404 :exc:`~werkzeug.exceptions.NotFound` error.
23
24    :param directory: The directory that ``path`` must be located under,
25        relative to the current application's root path.
26    :param path: The path to the file to send, relative to
27        ``directory``.
28    :param kwargs: Arguments to pass to :func:`send_file`.
29
30    .. versionchanged:: 2.0
31        ``path`` replaces the ``filename`` parameter.
32
33    .. versionadded:: 2.0
34        Moved the implementation to Werkzeug. This is now a wrapper to
35        pass some Flask-specific arguments.
36
37    .. versionadded:: 0.5
38    """
39    return werkzeug.utils.send_from_directory(  # type: ignore[return-value]
40        directory, path, **_prepare_send_file_kwargs(**kwargs)
41    )