@@ -7089,20 +7089,20 @@ def ArchiveFileToArray(infile, fmttype="auto", filestart=0, seekstart=0, seekend
70897089 fp = infile
70907090 fp .seek (filestart , 0 )
70917091 fp = UncompressFileAlt (fp , formatspecs , filestart )
7092- checkcompressfile = CheckCompressionSubType (fp , formatspecs , filestart , True )
7093- if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
7094- formatspecs = formatspecs [checkcompressfile ]
7095- if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
7092+ compresscheck = CheckCompressionSubType (fp , formatspecs , filestart , True )
7093+ if (IsNestedDict (formatspecs ) and compresscheck in formatspecs ):
7094+ formatspecs = formatspecs [compresscheck ]
7095+ if (compresscheck == "tarfile" and TarFileCheck (infile )):
70967096 return TarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7097- elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
7097+ elif (compresscheck == "zipfile" and zipfile .is_zipfile (infile )):
70987098 return ZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7099- elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
7099+ elif (rarfile_support and compresscheck == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
71007100 return RarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7101- elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
7101+ elif (py7zr_support and compresscheck == "7zipfile" and py7zr .is_7zfile (infile )):
71027102 return SevenZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7103- elif (IsSingleDict (formatspecs ) and checkcompressfile != formatspecs ['format_magic' ]):
7103+ elif (IsSingleDict (formatspecs ) and compresscheck != formatspecs ['format_magic' ]):
71047104 return False
7105- elif (IsNestedDict (formatspecs ) and checkcompressfile not in formatspecs ):
7105+ elif (IsNestedDict (formatspecs ) and compresscheck not in formatspecs ):
71067106 return False
71077107 if (not fp ):
71087108 return False
@@ -7115,9 +7115,9 @@ def ArchiveFileToArray(infile, fmttype="auto", filestart=0, seekstart=0, seekend
71157115 shutil .copyfileobj (sys .stdin , fp )
71167116 fp .seek (filestart , 0 )
71177117 fp = UncompressFileAlt (fp , formatspecs , filestart )
7118- checkcompressfile = CheckCompressionSubType (fp , formatspecs , filestart , True )
7119- if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
7120- formatspecs = formatspecs [checkcompressfile ]
7118+ compresscheck = CheckCompressionSubType (fp , formatspecs , filestart , True )
7119+ if (IsNestedDict (formatspecs ) and compresscheck in formatspecs ):
7120+ formatspecs = formatspecs [compresscheck ]
71217121 if (not fp ):
71227122 return False
71237123 fp .seek (filestart , 0 )
@@ -7144,20 +7144,20 @@ def ArchiveFileToArray(infile, fmttype="auto", filestart=0, seekstart=0, seekend
71447144 fp .seek (filestart , 0 )
71457145 else :
71467146 infile = RemoveWindowsPath (infile )
7147- checkcompressfile = CheckCompressionSubType (infile , formatspecs , filestart , True )
7148- if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
7149- formatspecs = formatspecs [checkcompressfile ]
7150- if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
7147+ compresscheck = CheckCompressionSubType (infile , formatspecs , filestart , True )
7148+ if (IsNestedDict (formatspecs ) and compresscheck in formatspecs ):
7149+ formatspecs = formatspecs [compresscheck ]
7150+ if (compresscheck == "tarfile" and TarFileCheck (infile )):
71517151 return TarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7152- elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
7152+ elif (compresscheck == "zipfile" and zipfile .is_zipfile (infile )):
71537153 return ZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7154- elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
7154+ elif (rarfile_support and compresscheck == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
71557155 return RarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7156- elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
7156+ elif (py7zr_support and compresscheck == "7zipfile" and py7zr .is_7zfile (infile )):
71577157 return SevenZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
7158- elif (IsSingleDict (formatspecs ) and checkcompressfile != formatspecs ['format_magic' ]):
7158+ elif (IsSingleDict (formatspecs ) and compresscheck != formatspecs ['format_magic' ]):
71597159 return False
7160- elif (IsNestedDict (formatspecs ) and checkcompressfile not in formatspecs ):
7160+ elif (IsNestedDict (formatspecs ) and compresscheck not in formatspecs ):
71617161 return False
71627162 compresscheck = CheckCompressionType (infile , formatspecs , filestart , True )
71637163 if (not compresscheck ):
0 commit comments