diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs index 50f53f5..553cf62 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs @@ -58,7 +58,7 @@ public sealed partial class Plugin : IViewer, IMoreMenu ".eif", // QQ emoji file (Compound File Binary format) // List of supported chromium resource package file extensions - ".pak", // Chromium resource package file, used by Chromium-based applications (e.g., Google Chrome) + ".pak", // Chromium resource package file v5, used by Chromium-based applications (e.g., Google Chrome) ]; private IDisposable _panel; @@ -74,7 +74,31 @@ public sealed partial class Plugin : IViewer, IMoreMenu public bool CanHandle(string path) { - return !Directory.Exists(path) && _extensions.Any(path.ToLower().EndsWith); + if (Directory.Exists(path)) + return false; + + if (path.EndsWith(".pak", StringComparison.OrdinalIgnoreCase)) + { + // Chromium PAK files usually start with header as version + try + { + using var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + using var br = new BinaryReader(fs); + var version = br.ReadUInt32(); + + // Check for Chromium PAK version + // if v5 → PASS + // if v4 → FAIL (NOT Supported) + if (version == 5) return true; + } + catch + { + // Ignore file read errors, treat as not handled + } + return false; + } + + return _extensions.Any(ext => path.EndsWith(ext, StringComparison.OrdinalIgnoreCase)); } public void Prepare(string path, ContextObject context) diff --git a/SUPPORTED_FORMATS.md b/SUPPORTED_FORMATS.md index e654984..160b83a 100644 --- a/SUPPORTED_FORMATS.md +++ b/SUPPORTED_FORMATS.md @@ -215,6 +215,7 @@ Update not completed yet... - `.zip` (ZIP archive) - `.cfb` (Compound File Binary) - `.eif` (QQ EIF package with Compound File Binary format) +- `.pak` (Chromium resource package file v5, used by Chromium-based applications (e.g., Google Chrome)) ### Markdown files - `.md`, `.markdown` (Markdown)