@@ -2538,6 +2538,26 @@ def ReadInFileBySizeWithContentToArray(infile, seekstart=0, seekend=0, listonly=
25382538 return False
25392539 if (not fp ):
25402540 return False
2541+ if (not compresscheck and hasattr (catfp , "name" )):
2542+ fextname = os .path .splitext (catfp .name )[1 ]
2543+ if (fextname == ".gz" ):
2544+ compresscheck = "gzip"
2545+ elif (fextname == ".bz2" ):
2546+ compresscheck = "bzip2"
2547+ elif (fextname == ".zst" ):
2548+ compresscheck = "zstd"
2549+ elif (fextname == ".lz4" or fextname == ".clz4" ):
2550+ compresscheck = "lz4"
2551+ elif (fextname == ".lzo" or fextname == ".lzop" ):
2552+ compresscheck = "lzo"
2553+ elif (fextname == ".lzma" ):
2554+ compresscheck = "lzma"
2555+ elif (fextname == ".xz" ):
2556+ compresscheck = "xz"
2557+ elif (fextname == ".zz" or fextname == ".zl" or fextname == ".zlib" ):
2558+ compresscheck = "zlib"
2559+ else :
2560+ return False
25412561 fp .seek (0 , 0 )
25422562 elif (infile == "-" ):
25432563 fp = BytesIO ()
@@ -2625,6 +2645,26 @@ def ReadInFileBySizeWithContentToList(infile, seekstart=0, seekend=0, listonly=F
26252645 return False
26262646 if (not fp ):
26272647 return False
2648+ if (not compresscheck and hasattr (catfp , "name" )):
2649+ fextname = os .path .splitext (catfp .name )[1 ]
2650+ if (fextname == ".gz" ):
2651+ compresscheck = "gzip"
2652+ elif (fextname == ".bz2" ):
2653+ compresscheck = "bzip2"
2654+ elif (fextname == ".zst" ):
2655+ compresscheck = "zstd"
2656+ elif (fextname == ".lz4" or fextname == ".clz4" ):
2657+ compresscheck = "lz4"
2658+ elif (fextname == ".lzo" or fextname == ".lzop" ):
2659+ compresscheck = "lzo"
2660+ elif (fextname == ".lzma" ):
2661+ compresscheck = "lzma"
2662+ elif (fextname == ".xz" ):
2663+ compresscheck = "xz"
2664+ elif (fextname == ".zz" or fextname == ".zl" or fextname == ".zlib" ):
2665+ compresscheck = "zlib"
2666+ else :
2667+ return False
26282668 fp .seek (0 , 0 )
26292669 elif (infile == "-" ):
26302670 fp = BytesIO ()
@@ -5548,6 +5588,26 @@ def ArchiveFileSeekToFileNum(infile, seekto=0, listonly=False, contentasfile=Tru
55485588 return False
55495589 if (not catfp ):
55505590 return False
5591+ if (not compresscheck and hasattr (catfp , "name" )):
5592+ fextname = os .path .splitext (catfp .name )[1 ]
5593+ if (fextname == ".gz" ):
5594+ compresscheck = "gzip"
5595+ elif (fextname == ".bz2" ):
5596+ compresscheck = "bzip2"
5597+ elif (fextname == ".zst" ):
5598+ compresscheck = "zstd"
5599+ elif (fextname == ".lz4" or fextname == ".clz4" ):
5600+ compresscheck = "lz4"
5601+ elif (fextname == ".lzo" or fextname == ".lzop" ):
5602+ compresscheck = "lzo"
5603+ elif (fextname == ".lzma" ):
5604+ compresscheck = "lzma"
5605+ elif (fextname == ".xz" ):
5606+ compresscheck = "xz"
5607+ elif (fextname == ".zz" or fextname == ".zl" or fextname == ".zlib" ):
5608+ compresscheck = "zlib"
5609+ else :
5610+ return False
55515611 catfp .seek (0 , 0 )
55525612 elif (infile == "-" ):
55535613 catfp = BytesIO ()
@@ -6125,6 +6185,26 @@ def ArchiveFileValidate(infile, formatspecs=__file_format_dict__, verbose=False,
61256185 return False
61266186 if (not catfp ):
61276187 return False
6188+ if (not compresscheck and hasattr (catfp , "name" )):
6189+ fextname = os .path .splitext (catfp .name )[1 ]
6190+ if (fextname == ".gz" ):
6191+ compresscheck = "gzip"
6192+ elif (fextname == ".bz2" ):
6193+ compresscheck = "bzip2"
6194+ elif (fextname == ".zst" ):
6195+ compresscheck = "zstd"
6196+ elif (fextname == ".lz4" or fextname == ".clz4" ):
6197+ compresscheck = "lz4"
6198+ elif (fextname == ".lzo" or fextname == ".lzop" ):
6199+ compresscheck = "lzo"
6200+ elif (fextname == ".lzma" ):
6201+ compresscheck = "lzma"
6202+ elif (fextname == ".xz" ):
6203+ compresscheck = "xz"
6204+ elif (fextname == ".zz" or fextname == ".zl" or fextname == ".zlib" ):
6205+ compresscheck = "zlib"
6206+ else :
6207+ return False
61286208 catfp .seek (0 , 0 )
61296209 elif (infile == "-" ):
61306210 catfp = BytesIO ()
@@ -6418,6 +6498,26 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentas
64186498 return False
64196499 if (not catfp ):
64206500 return False
6501+ if (not compresscheck and hasattr (catfp , "name" )):
6502+ fextname = os .path .splitext (catfp .name )[1 ]
6503+ if (fextname == ".gz" ):
6504+ compresscheck = "gzip"
6505+ elif (fextname == ".bz2" ):
6506+ compresscheck = "bzip2"
6507+ elif (fextname == ".zst" ):
6508+ compresscheck = "zstd"
6509+ elif (fextname == ".lz4" or fextname == ".clz4" ):
6510+ compresscheck = "lz4"
6511+ elif (fextname == ".lzo" or fextname == ".lzop" ):
6512+ compresscheck = "lzo"
6513+ elif (fextname == ".lzma" ):
6514+ compresscheck = "lzma"
6515+ elif (fextname == ".xz" ):
6516+ compresscheck = "xz"
6517+ elif (fextname == ".zz" or fextname == ".zl" or fextname == ".zlib" ):
6518+ compresscheck = "zlib"
6519+ else :
6520+ return False
64216521 catfp .seek (0 , 0 )
64226522 elif (infile == "-" ):
64236523 catfp = BytesIO ()
0 commit comments