Skip to content

Commit 976397c

Browse files
committed
Fix tar extraction
1 parent 137c101 commit 976397c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

zstash/extract.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,11 @@ def _extractFiles_impl( # noqa: C901
770770
logger.debug("Valid md5: {} {}".format(md5, fname))
771771

772772
elif extract_this_file:
773-
tar.extract(tarinfo)
773+
# Python 3.11 and earlier don't support the filter parameter at all
774+
if sys.version_info >= (3, 12):
775+
tar.extract(tarinfo, filter="tar")
776+
else:
777+
tar.extract(tarinfo)
774778
# Note: tar.extract() will not restore time stamps of symbolic
775779
# links. Could not find a Python-way to restore it either, so
776780
# relying here on 'touch'. This is not the prettiest solution.

0 commit comments

Comments
 (0)