@@ -2051,7 +2051,7 @@ def CheckCompressionSubType(infile, formatspecs=__file_format_multi_dict__, file
20512051 return False
20522052 elif (IsNestedDict (formatspecs ) and compresscheck in formatspecs ):
20532053 return formatspecs [compresscheck ]['format_magic' ]
2054- elif (IsSingleDict (formatspecs ) and compresscheck == formatspecs ['format_magic' ]):
2054+ elif (IsSingleDict (formatspecs ) and 'format_magic' in formatspecs and compresscheck == formatspecs ['format_magic' ]):
20552055 return formatspecs ['format_magic' ]
20562056 elif (compresscheck == "tarfile" ):
20572057 return "tarfile"
@@ -8386,6 +8386,8 @@ def PackCatFileFromInFile(infile, outfile, fmttype="auto", compression="auto", c
83868386 checkcompressfile = CheckCompressionSubType (infile , formatspecs , 0 , True )
83878387 if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
83888388 ckformatspecs = formatspecs [checkcompressfile ]
8389+ else :
8390+ ckformatspecs = formatspecs
83898391 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
83908392 return PackCatFileFromTarFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , compressionuselist , checksumtype , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
83918393 elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
@@ -8394,7 +8396,7 @@ def PackCatFileFromInFile(infile, outfile, fmttype="auto", compression="auto", c
83948396 return PackCatFileFromRarFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , compressionuselist , checksumtype , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
83958397 elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
83968398 return PackCatFileFromSevenZipFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , compressionuselist , checksumtype , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
8397- elif (checkcompressfile == ckformatspecs ['format_magic' ]):
8399+ elif ('format_magic' in ckformatspecs and checkcompressfile == ckformatspecs ['format_magic' ]):
83988400 return RePackCatFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , False , 0 , 0 , checksumtype , False , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
83998401 else :
84008402 return PackCatFileFromBSDTarFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , compressionuselist , checksumtype , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
@@ -8802,6 +8804,8 @@ def InFileToArray(infile, fmttype=__file_format_default__, filestart=0, seekstar
88028804 checkcompressfile = CheckCompressionSubType (infile , formatspecs , filestart , True )
88038805 if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
88048806 ckformatspecs = formatspecs [checkcompressfile ]
8807+ else :
8808+ ckformatspecs = formatspecs
88058809 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
88068810 return TarFileToArray (infile , fmttype , seekstart , seekend , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
88078811 elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
@@ -8810,7 +8814,7 @@ def InFileToArray(infile, fmttype=__file_format_default__, filestart=0, seekstar
88108814 return RarFileToArray (infile , fmttype , seekstart , seekend , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
88118815 elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
88128816 return SevenZipFileToArray (infile , fmttype , seekstart , seekend , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
8813- elif (checkcompressfile == ckformatspecs ['format_magic' ]):
8817+ elif ('format_magic' in ckformatspecs and checkcompressfile == ckformatspecs ['format_magic' ]):
88148818 return CatFileToArray (infile , "auto" , filestart , seekstart , seekend , listonly , contentasfile , True , skipchecksum , formatspecs , saltkey , seektoend , returnfp )
88158819 else :
88168820 return BSDTarFileToArray (infile , fmttype , seekstart , seekend , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
@@ -10411,6 +10415,8 @@ def InFileListFiles(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
1041110415 checkcompressfile = CheckCompressionSubType (infile , formatspecs , filestart , True )
1041210416 if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
1041310417 ckformatspecs = formatspecs [checkcompressfile ]
10418+ else :
10419+ ckformatspecs = formatspecs
1041410420 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
1041510421 return TarFileListFiles (infile , formatspecs , verbose , returnfp )
1041610422 elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
@@ -10419,7 +10425,7 @@ def InFileListFiles(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
1041910425 return RarFileListFiles (infile , verbose , returnfp )
1042010426 elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
1042110427 return SevenZipFileListFiles (infile , verbose , returnfp )
10422- elif (checkcompressfile == ckformatspecs ['format_magic' ]):
10428+ elif ('format_magic' in ckformatspecs and checkcompressfile == ckformatspecs ['format_magic' ]):
1042310429 return ArchiveFileListFiles (infile , fmttype , filestart , seekstart , seekend , skipchecksum , formatspecs , saltkey , seektoend , verbose , newstyle , returnfp )
1042410430 else :
1042510431 return BSDTarFileListFiles (infile , formatspecs , verbose , returnfp )
0 commit comments