Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaPrzyborowski authored Dec 25, 2024
1 parent 47b0a42 commit 309a07d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pycatfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3581,7 +3581,7 @@ def CompressArchiveFile(fp, compression="auto", compressionlevel=None, formatspe
compressionlevel = int(compressionlevel)
try:
catfp.write(lzma.compress(fp.read(), format=lzma.FORMAT_ALONE, filters=[{"id": lzma.FILTER_LZMA1, "preset": compressionlevel}]))
except NotImplemented:
except (NotImplementedError, lzma.LZMAError):
catfp.write(lzma.compress(fp.read(), format=lzma.FORMAT_ALONE))
if(compression == "xz" and compression in compressionsupport):
catfp = BytesIO()
Expand All @@ -3591,7 +3591,7 @@ def CompressArchiveFile(fp, compression="auto", compressionlevel=None, formatspe
compressionlevel = int(compressionlevel)
try:
catfp.write(lzma.compress(fp.read(), format=lzma.FORMAT_XZ, filters=[{"id": lzma.FILTER_LZMA2, "preset": compressionlevel}]))
except NotImplemented:
except (NotImplementedError, lzma.LZMAError):
catfp.write(lzma.compress(fp.read(), format=lzma.FORMAT_XZ))
if(compression == "zlib" and compression in compressionsupport):
catfp = BytesIO()
Expand Down Expand Up @@ -3638,7 +3638,7 @@ def CompressOpenFile(outfile, compressionenable=True, compressionlevel=None):
elif(fextname == ".xz" and "xz" in compressionsupport):
try:
outfp = lzma.open(outfile, mode, format=lzma.FORMAT_XZ, filters=[{"id": lzma.FILTER_LZMA2, "preset": compressionlevel}])
except NotImplemented:
except (NotImplementedError, lzma.LZMAError):
outfp = lzma.open(outfile, mode, format=lzma.FORMAT_XZ)
elif(fextname == ".lz4" and "lz4" in compressionsupport):
outfp = lz4.frame.open(
Expand All @@ -3648,7 +3648,7 @@ def CompressOpenFile(outfile, compressionenable=True, compressionlevel=None):
elif(fextname == ".lzma" and "lzma" in compressionsupport):
try:
outfp = lzma.open(outfile, mode, format=lzma.FORMAT_ALONE, filters=[{"id": lzma.FILTER_LZMA1, "preset": compressionlevel}])
except NotImplemented:
except (NotImplementedError, lzma.LZMAError):
outfp = lzma.open(outfile, mode, format=lzma.FORMAT_ALONE)
elif((fextname == ".zz" or fextname == ".zl" or fextname == ".zlib") and "zlib" in compressionsupport):
outfp = ZlibFile(outfile, mode=mode, level=compressionlevel)
Expand Down

0 comments on commit 309a07d

Please sign in to comment.