Skip to content

Commit 263e9ea

Browse files
committed
Small update
1 parent e9b5dab commit 263e9ea

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

pyfoxfile/pyfile.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import json
2727
import stat
2828
import shutil
29+
import base64
2930
import logging
3031
import zipfile
3132
import platform
@@ -83,20 +84,14 @@
8384

8485
# TAR file checking
8586
try:
86-
from xtarfile import is_tarfile
87+
from safetar import is_tarfile
8788
except ImportError:
88-
try:
89-
from safetar import is_tarfile
90-
except ImportError:
91-
from tarfile import is_tarfile
89+
from tarfile import is_tarfile
9290

9391
# TAR file module
9492
try:
95-
import xtarfile as tarfile
93+
import safetar as tarfile
9694
except ImportError:
97-
try:
98-
import safetar as tarfile
99-
except ImportError:
10095
import tarfile
10196

10297
try:
@@ -1817,7 +1812,7 @@ def CheckCompressionType(infile, formatspecs=__file_format_multi_dict__, filesta
18171812
if(prefp == binascii.unhexlify("7061785f676c6f62616c")):
18181813
filetype = "tarfile"
18191814
fp.seek(curloc, 0)
1820-
if(filetype == "gzip" or filetype == "bzip2" or filetype == "lzma" or filetype == "zstd" or filetype == "lz4" or filetype == "zlib"):
1815+
if(filetype == "gzip" or filetype == "bzip2" or filetype == "lzma" or filetype == "xz" or filetype == "zstd" or filetype == "lz4" or filetype == "zlib"):
18211816
if(TarFileCheck(fp)):
18221817
filetype = "tarfile"
18231818
elif(not filetype):
@@ -1858,7 +1853,7 @@ def CheckCompressionSubType(infile, formatspecs=__file_format_multi_dict__, file
18581853
compresscheck = "zlib"
18591854
else:
18601855
return False
1861-
if(compresscheck == "gzip" or compresscheck == "bzip2" or compresscheck == "lzma" or compresscheck == "zstd" or compresscheck == "lz4" or compresscheck == "zlib"):
1856+
if(compresscheck == "gzip" or compresscheck == "bzip2" or compresscheck == "lzma" or compresscheck == "xz" or compresscheck == "zstd" or compresscheck == "lz4" or compresscheck == "zlib"):
18621857
if(TarFileCheck(infile)):
18631858
filetype = "tarfile"
18641859
elif(not compresscheck):
@@ -6238,6 +6233,11 @@ def AppendFilesWithContentFromTarFileToList(infile, extradata=[], jsondata={}, c
62386233
fcontents = MkTempFile()
62396234
fcencoding = "UTF-8"
62406235
curcompression = "none"
6236+
pax_headers = getattr(member, "pax_headers", None)
6237+
if(not pax_headers):
6238+
pax_headers = None
6239+
if(pax_headers is not None):
6240+
jsondata.update({'pax_headers': pax_headers})
62416241
if ftype in data_types:
62426242
fpc = tarfp.extractfile(member)
62436243
shutil.copyfileobj(fpc, fcontents, length=__filebuff_size__)

0 commit comments

Comments
 (0)