Skip to content

Commit

Permalink
avoid tarfile deprecation warning for py312
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasWaldmann committed Sep 14, 2023
1 parent c4327c2 commit 1ed7f29
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/borg/archiver/tar_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@

logger = create_logger(__name__)

# Python 3.12+ gives a deprecation warning if TarFile.extraction_filter is None.
# https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter
if hasattr(tarfile, "fully_trusted_filter"):
tarfile.TarFile.extraction_filter = staticmethod(tarfile.fully_trusted_filter) # type: ignore


def get_tar_filter(fname, decompress):
# Note that filter is None if fname is '-'.
Expand Down

0 comments on commit 1ed7f29

Please sign in to comment.