From b31de49da189fedc27664eb921b5dc13af9de732 Mon Sep 17 00:00:00 2001 From: ema Date: Thu, 5 Jun 2025 14:46:19 +0800 Subject: [PATCH] Not support deb with LZMA algorithm --- .../PackageParsers/Deb/DebReader.cs | 43 +++++-------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/PackageParsers/Deb/DebReader.cs b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/PackageParsers/Deb/DebReader.cs index a0252cf..d3b5bb7 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.AppViewer/PackageParsers/Deb/DebReader.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.AppViewer/PackageParsers/Deb/DebReader.cs @@ -19,9 +19,8 @@ using PureSharpCompress.Archives; using PureSharpCompress.Compressors; using PureSharpCompress.Compressors.BZip2; using PureSharpCompress.Compressors.Deflate; -using PureSharpCompress.Compressors.Deflate64; -using PureSharpCompress.Compressors.LZMA; using PureSharpCompress.Compressors.Xz; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -107,16 +106,13 @@ public class DebReader private static ZipCompressionMethod GetCompressionMethodFromFileName(string fileName) { fileName = fileName.ToLowerInvariant(); - if (fileName.EndsWith(".tar.gz") || fileName.EndsWith(".tgz")) - return ZipCompressionMethod.Deflate; - else if (fileName.EndsWith(".tar.xz")) - return ZipCompressionMethod.Xz; - else if (fileName.EndsWith(".tar.bz2")) - return ZipCompressionMethod.BZip2; - else if (fileName.EndsWith(".tar.lzma")) - return ZipCompressionMethod.LZMA; - else if (fileName.EndsWith(".tar.zst")) - return ZipCompressionMethod.ZStd; + + // Check the format from ".tar.*" + if (fileName.EndsWith(".tar.gz")) return ZipCompressionMethod.Deflate; + else if (fileName.EndsWith(".tar.xz")) return ZipCompressionMethod.Xz; + else if (fileName.EndsWith(".tar.bz2")) return ZipCompressionMethod.BZip2; + else if (fileName.EndsWith(".tar.lzma")) return ZipCompressionMethod.LZMA; + else if (fileName.EndsWith(".tar.zst")) return ZipCompressionMethod.ZStd; return ZipCompressionMethod.None; } @@ -135,16 +131,7 @@ public class DebReader } case ZipCompressionMethod.LZMA: { - var reader = new BinaryReader(stream); - reader.ReadUInt16(); //LZMA version - var props = new byte[reader.ReadUInt16()]; - reader.Read(props, 0, props.Length); - return new LzmaStream( - props, - stream, - stream.Length - 4, - -1 - ); + throw new NotSupportedException("Plugin NOT support deb with LZMA algorithm"); } case ZipCompressionMethod.Xz: { @@ -152,8 +139,7 @@ public class DebReader } case ZipCompressionMethod.ZStd: { - // Not supported for ZStd - return default; + throw new NotSupportedException("Plugin NOT support deb with ZStd algorithm"); } } @@ -163,19 +149,10 @@ public class DebReader private enum ZipCompressionMethod { None = 0, - Shrink = 1, - Reduce1 = 2, - Reduce2 = 3, - Reduce3 = 4, - Reduce4 = 5, - Explode = 6, Deflate = 8, - Deflate64 = 9, BZip2 = 12, LZMA = 14, ZStd = 93, Xz = 95, - PPMd = 98, - WinzipAes = 0x63, } }