@@ -2045,7 +2045,7 @@ def CheckCompressionSubType(infile, formatspecs=__file_format_multi_dict__, file
20452045 return False
20462046 elif (IsNestedDict (formatspecs ) and compresscheck in formatspecs ):
20472047 return formatspecs [compresscheck ]['format_magic' ]
2048- elif (IsSingleDict (formatspecs ) and compresscheck == formatspecs ['format_magic' ]):
2048+ elif (IsSingleDict (formatspecs ) and 'format_magic' in formatspecs and compresscheck == formatspecs ['format_magic' ]):
20492049 return formatspecs ['format_magic' ]
20502050 elif (compresscheck == "tarfile" ):
20512051 return "tarfile"
@@ -8380,6 +8380,8 @@ def PackNeoFileFromInFile(infile, outfile, fmttype="auto", compression="auto", c
83808380 checkcompressfile = CheckCompressionSubType (infile , formatspecs , 0 , True )
83818381 if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
83828382 ckformatspecs = formatspecs [checkcompressfile ]
8383+ else :
8384+ ckformatspecs = formatspecs
83838385 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
83848386 return PackNeoFileFromTarFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , compressionuselist , checksumtype , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
83858387 elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
@@ -8388,7 +8390,7 @@ def PackNeoFileFromInFile(infile, outfile, fmttype="auto", compression="auto", c
83888390 return PackNeoFileFromRarFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , compressionuselist , checksumtype , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
83898391 elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
83908392 return PackNeoFileFromSevenZipFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , compressionuselist , checksumtype , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
8391- elif (checkcompressfile == ckformatspecs ['format_magic' ]):
8393+ elif ('format_magic' in ckformatspecs and checkcompressfile == ckformatspecs ['format_magic' ]):
83928394 return RePackNeoFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , False , 0 , 0 , checksumtype , False , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
83938395 else :
83948396 return PackNeoFileFromBSDTarFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , compressionuselist , checksumtype , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
@@ -8796,6 +8798,8 @@ def InFileToArray(infile, fmttype=__file_format_default__, filestart=0, seekstar
87968798 checkcompressfile = CheckCompressionSubType (infile , formatspecs , filestart , True )
87978799 if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
87988800 ckformatspecs = formatspecs [checkcompressfile ]
8801+ else :
8802+ ckformatspecs = formatspecs
87998803 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
88008804 return TarFileToArray (infile , fmttype , seekstart , seekend , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
88018805 elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
@@ -8804,7 +8808,7 @@ def InFileToArray(infile, fmttype=__file_format_default__, filestart=0, seekstar
88048808 return RarFileToArray (infile , fmttype , seekstart , seekend , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
88058809 elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
88068810 return SevenZipFileToArray (infile , fmttype , seekstart , seekend , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
8807- elif (checkcompressfile == ckformatspecs ['format_magic' ]):
8811+ elif ('format_magic' in ckformatspecs and checkcompressfile == ckformatspecs ['format_magic' ]):
88088812 return NeoFileToArray (infile , "auto" , filestart , seekstart , seekend , listonly , contentasfile , True , skipchecksum , formatspecs , saltkey , seektoend , returnfp )
88098813 else :
88108814 return BSDTarFileToArray (infile , fmttype , seekstart , seekend , listonly , contentasfile , skipchecksum , formatspecs , seektoend , returnfp )
@@ -10405,6 +10409,8 @@ def InFileListFiles(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
1040510409 checkcompressfile = CheckCompressionSubType (infile , formatspecs , filestart , True )
1040610410 if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
1040710411 ckformatspecs = formatspecs [checkcompressfile ]
10412+ else :
10413+ ckformatspecs = formatspecs
1040810414 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
1040910415 return TarFileListFiles (infile , formatspecs , verbose , returnfp )
1041010416 elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
@@ -10413,7 +10419,7 @@ def InFileListFiles(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
1041310419 return RarFileListFiles (infile , verbose , returnfp )
1041410420 elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
1041510421 return SevenZipFileListFiles (infile , verbose , returnfp )
10416- elif (checkcompressfile == ckformatspecs ['format_magic' ]):
10422+ elif ('format_magic' in ckformatspecs and checkcompressfile == ckformatspecs ['format_magic' ]):
1041710423 return ArchiveFileListFiles (infile , fmttype , filestart , seekstart , seekend , skipchecksum , formatspecs , saltkey , seektoend , verbose , newstyle , returnfp )
1041810424 else :
1041910425 return BSDTarFileListFiles (infile , formatspecs , verbose , returnfp )
0 commit comments