|
26 | 26 | import json |
27 | 27 | import stat |
28 | 28 | import shutil |
| 29 | +import base64 |
29 | 30 | import logging |
30 | 31 | import zipfile |
31 | 32 | import platform |
|
83 | 84 |
|
84 | 85 | # TAR file checking |
85 | 86 | try: |
86 | | - from xtarfile import is_tarfile |
| 87 | + from safetar import is_tarfile |
87 | 88 | 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 |
92 | 90 |
|
93 | 91 | # TAR file module |
94 | 92 | try: |
95 | | - import xtarfile as tarfile |
| 93 | + import safetar as tarfile |
96 | 94 | except ImportError: |
97 | | - try: |
98 | | - import safetar as tarfile |
99 | | - except ImportError: |
100 | 95 | import tarfile |
101 | 96 |
|
102 | 97 | try: |
@@ -1817,7 +1812,7 @@ def CheckCompressionType(infile, formatspecs=__file_format_multi_dict__, filesta |
1817 | 1812 | if(prefp == binascii.unhexlify("7061785f676c6f62616c")): |
1818 | 1813 | filetype = "tarfile" |
1819 | 1814 | 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"): |
1821 | 1816 | if(TarFileCheck(fp)): |
1822 | 1817 | filetype = "tarfile" |
1823 | 1818 | elif(not filetype): |
@@ -1858,7 +1853,7 @@ def CheckCompressionSubType(infile, formatspecs=__file_format_multi_dict__, file |
1858 | 1853 | compresscheck = "zlib" |
1859 | 1854 | else: |
1860 | 1855 | 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"): |
1862 | 1857 | if(TarFileCheck(infile)): |
1863 | 1858 | filetype = "tarfile" |
1864 | 1859 | elif(not compresscheck): |
@@ -6238,6 +6233,11 @@ def AppendFilesWithContentFromTarFileToList(infile, extradata=[], jsondata={}, c |
6238 | 6233 | fcontents = MkTempFile() |
6239 | 6234 | fcencoding = "UTF-8" |
6240 | 6235 | 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}) |
6241 | 6241 | if ftype in data_types: |
6242 | 6242 | fpc = tarfp.extractfile(member) |
6243 | 6243 | shutil.copyfileobj(fpc, fcontents, length=__filebuff_size__) |
|
0 commit comments