@@ -7102,20 +7102,20 @@ def CatFileToArray(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
71027102 fp = infile
71037103 fp .seek (filestart , 0 )
71047104 fp = UncompressFileAlt (fp , formatspecs , filestart )
7105- checkcompressfile = CheckCompressionSubType (fp , formatspecs , filestart , True )
7106- if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
7107- formatspecs = formatspecs [checkcompressfile ]
7108- if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
7105+ compresscheck = CheckCompressionSubType (fp , formatspecs , filestart , True )
7106+ if (IsNestedDict (formatspecs ) and compresscheck in formatspecs ):
7107+ formatspecs = formatspecs [compresscheck ]
7108+ if (compresscheck == "tarfile" and TarFileCheck (infile )):
71097109 return TarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7110- elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
7110+ elif (compresscheck == "zipfile" and zipfile .is_zipfile (infile )):
71117111 return ZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7112- elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
7112+ elif (rarfile_support and compresscheck == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
71137113 return RarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7114- elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
7114+ elif (py7zr_support and compresscheck == "7zipfile" and py7zr .is_7zfile (infile )):
71157115 return SevenZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7116- elif (IsSingleDict (formatspecs ) and checkcompressfile != formatspecs ['format_magic' ]):
7116+ elif (IsSingleDict (formatspecs ) and compresscheck != formatspecs ['format_magic' ]):
71177117 return False
7118- elif (IsNestedDict (formatspecs ) and checkcompressfile not in formatspecs ):
7118+ elif (IsNestedDict (formatspecs ) and compresscheck not in formatspecs ):
71197119 return False
71207120 if (not fp ):
71217121 return False
@@ -7128,9 +7128,9 @@ def CatFileToArray(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
71287128 shutil .copyfileobj (sys .stdin , fp )
71297129 fp .seek (filestart , 0 )
71307130 fp = UncompressFileAlt (fp , formatspecs , filestart )
7131- checkcompressfile = CheckCompressionSubType (fp , formatspecs , filestart , True )
7132- if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
7133- formatspecs = formatspecs [checkcompressfile ]
7131+ compresscheck = CheckCompressionSubType (fp , formatspecs , filestart , True )
7132+ if (IsNestedDict (formatspecs ) and compresscheck in formatspecs ):
7133+ formatspecs = formatspecs [compresscheck ]
71347134 if (not fp ):
71357135 return False
71367136 fp .seek (filestart , 0 )
@@ -7157,20 +7157,20 @@ def CatFileToArray(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
71577157 fp .seek (filestart , 0 )
71587158 else :
71597159 infile = RemoveWindowsPath (infile )
7160- checkcompressfile = CheckCompressionSubType (infile , formatspecs , filestart , True )
7161- if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
7162- formatspecs = formatspecs [checkcompressfile ]
7163- if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
7160+ compresscheck = CheckCompressionSubType (infile , formatspecs , filestart , True )
7161+ if (IsNestedDict (formatspecs ) and compresscheck in formatspecs ):
7162+ formatspecs = formatspecs [compresscheck ]
7163+ if (compresscheck == "tarfile" and TarFileCheck (infile )):
71647164 return TarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7165- elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
7165+ elif (compresscheck == "zipfile" and zipfile .is_zipfile (infile )):
71667166 return ZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7167- elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
7167+ elif (rarfile_support and compresscheck == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
71687168 return RarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7169- elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
7169+ elif (py7zr_support and compresscheck == "7zipfile" and py7zr .is_7zfile (infile )):
71707170 return SevenZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7171- elif (IsSingleDict (formatspecs ) and checkcompressfile != formatspecs ['format_magic' ]):
7171+ elif (IsSingleDict (formatspecs ) and compresscheck != formatspecs ['format_magic' ]):
71727172 return False
7173- elif (IsNestedDict (formatspecs ) and checkcompressfile not in formatspecs ):
7173+ elif (IsNestedDict (formatspecs ) and compresscheck not in formatspecs ):
71747174 return False
71757175 compresscheck = CheckCompressionType (infile , formatspecs , filestart , True )
71767176 if (not compresscheck ):
0 commit comments