remove deprecated safe_join

This commit is contained in:
David Lord 2021-11-12 09:24:32 -08:00
parent 218534a9f2
commit b7501776a1
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
4 changed files with 2 additions and 27 deletions

View File

@ -13,6 +13,8 @@ Unreleased
- ``config.from_json`` is replaced by
``config.from_file(name, load=json.load)``.
- ``json`` functions no longer take an ``encoding`` parameter.
- ``safe_join`` is removed, use ``werkzeug.utils.safe_join``
instead.
Version 2.0.2

View File

@ -218,8 +218,6 @@ Useful Functions and Classes
.. autofunction:: send_from_directory
.. autofunction:: safe_join
.. autofunction:: escape
.. autoclass:: Markup

View File

@ -23,7 +23,6 @@ from .helpers import flash as flash
from .helpers import get_flashed_messages as get_flashed_messages
from .helpers import get_template_attribute as get_template_attribute
from .helpers import make_response as make_response
from .helpers import safe_join as safe_join
from .helpers import send_file as send_file
from .helpers import send_from_directory as send_from_directory
from .helpers import stream_with_context as stream_with_context

View File

@ -11,7 +11,6 @@ from functools import update_wrapper
from threading import RLock
import werkzeug.utils
from werkzeug.exceptions import NotFound
from werkzeug.routing import BuildError
from werkzeug.urls import url_quote
@ -627,29 +626,6 @@ def send_file(
)
def safe_join(directory: str, *pathnames: str) -> str:
"""Safely join zero or more untrusted path components to a base
directory to avoid escaping the base directory.
:param directory: The trusted base directory.
:param pathnames: The untrusted path components relative to the
base directory.
:return: A safe path, otherwise ``None``.
"""
warnings.warn(
"'flask.helpers.safe_join' is deprecated and will be removed in"
" Flask 2.1. Use 'werkzeug.utils.safe_join' instead.",
DeprecationWarning,
stacklevel=2,
)
path = werkzeug.utils.safe_join(directory, *pathnames)
if path is None:
raise NotFound()
return path
def send_from_directory(
directory: t.Union[os.PathLike, str],
path: t.Union[os.PathLike, str],