flake8
passed.
JSHint
passed.
Review Request #13166 — Created July 31, 2023 and submitted
This introduces
djblets.util.filesystem.safe_join()
, a port and
modernization of Django's internaldjango.utils._os.safe_join()
. This
will join a series of paths and validate the result, making sure that
the resulting path is confined to the base path.Our version also allows the result to be returned as a relative path,
and to use a specific pathing module (ntpath
orposixpath
). It also
provides type hints.The main benefit is to avoid relying on an internal function that Django
may remove or substantially change at any time.
Unit tests pass.
Used this in some in-progress code.
Summary | ID |
---|---|
f22ba6c57e4d209780dd2fbd5fd215b79c984d77 |