@@ -7101,20 +7101,20 @@ def FoxFileToArray(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
71017101 fp = infile
71027102 fp .seek (filestart , 0 )
71037103 fp = UncompressFileAlt (fp , formatspecs , filestart )
7104- checkcompressfile = CheckCompressionSubType (fp , formatspecs , filestart , True )
7105- if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
7106- formatspecs = formatspecs [checkcompressfile ]
7107- if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
7104+ compresscheck = CheckCompressionSubType (fp , formatspecs , filestart , True )
7105+ if (IsNestedDict (formatspecs ) and compresscheck in formatspecs ):
7106+ formatspecs = formatspecs [compresscheck ]
7107+ if (compresscheck == "tarfile" and TarFileCheck (infile )):
71087108 return TarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7109- elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
7109+ elif (compresscheck == "zipfile" and zipfile .is_zipfile (infile )):
71107110 return ZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7111- elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
7111+ elif (rarfile_support and compresscheck == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
71127112 return RarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7113- elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
7113+ elif (py7zr_support and compresscheck == "7zipfile" and py7zr .is_7zfile (infile )):
71147114 return SevenZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7115- elif (IsSingleDict (formatspecs ) and checkcompressfile != formatspecs ['format_magic' ]):
7115+ elif (IsSingleDict (formatspecs ) and compresscheck != formatspecs ['format_magic' ]):
71167116 return False
7117- elif (IsNestedDict (formatspecs ) and checkcompressfile not in formatspecs ):
7117+ elif (IsNestedDict (formatspecs ) and compresscheck not in formatspecs ):
71187118 return False
71197119 if (not fp ):
71207120 return False
@@ -7127,9 +7127,9 @@ def FoxFileToArray(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
71277127 shutil .copyfileobj (sys .stdin , fp )
71287128 fp .seek (filestart , 0 )
71297129 fp = UncompressFileAlt (fp , formatspecs , filestart )
7130- checkcompressfile = CheckCompressionSubType (fp , formatspecs , filestart , True )
7131- if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
7132- formatspecs = formatspecs [checkcompressfile ]
7130+ compresscheck = CheckCompressionSubType (fp , formatspecs , filestart , True )
7131+ if (IsNestedDict (formatspecs ) and compresscheck in formatspecs ):
7132+ formatspecs = formatspecs [compresscheck ]
71337133 if (not fp ):
71347134 return False
71357135 fp .seek (filestart , 0 )
@@ -7156,20 +7156,20 @@ def FoxFileToArray(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
71567156 fp .seek (filestart , 0 )
71577157 else :
71587158 infile = RemoveWindowsPath (infile )
7159- checkcompressfile = CheckCompressionSubType (infile , formatspecs , filestart , True )
7160- if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
7161- formatspecs = formatspecs [checkcompressfile ]
7162- if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
7159+ compresscheck = CheckCompressionSubType (infile , formatspecs , filestart , True )
7160+ if (IsNestedDict (formatspecs ) and compresscheck in formatspecs ):
7161+ formatspecs = formatspecs [compresscheck ]
7162+ if (compresscheck == "tarfile" and TarFileCheck (infile )):
71637163 return TarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7164- elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
7164+ elif (compresscheck == "zipfile" and zipfile .is_zipfile (infile )):
71657165 return ZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7166- elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
7166+ elif (rarfile_support and compresscheck == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
71677167 return RarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7168- elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
7168+ elif (py7zr_support and compresscheck == "7zipfile" and py7zr .is_7zfile (infile )):
71697169 return SevenZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7170- elif (IsSingleDict (formatspecs ) and checkcompressfile != formatspecs ['format_magic' ]):
7170+ elif (IsSingleDict (formatspecs ) and compresscheck != formatspecs ['format_magic' ]):
71717171 return False
7172- elif (IsNestedDict (formatspecs ) and checkcompressfile not in formatspecs ):
7172+ elif (IsNestedDict (formatspecs ) and compresscheck not in formatspecs ):
71737173 return False
71747174 compresscheck = CheckCompressionType (infile , formatspecs , filestart , True )
71757175 if (not compresscheck ):
0 commit comments