From cea937c0d642d002046ef9116585821e41f453aa Mon Sep 17 00:00:00 2001 From: ema Date: Thu, 18 Dec 2025 16:19:23 +0800 Subject: [PATCH] Improve XML version attribute regex in XMLDetector Updated the XMLDetector regex to support both single and double quotes in the XML version attribute, improving compatibility with different XML declaration styles. Now supports: --- .../QuickLook.Plugin.TextViewer/Detectors/XMLDetector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Detectors/XMLDetector.cs b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Detectors/XMLDetector.cs index 1fa5fba..22367bb 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Detectors/XMLDetector.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Detectors/XMLDetector.cs @@ -21,7 +21,7 @@ namespace QuickLook.Plugin.TextViewer.Detectors; public sealed class XMLDetector : IFormatDetector { - internal Regex Signature { get; } = new(@"<\?xml\b[^>]*\bversion\s*=\s*""[^""]*""[^\?>]*\?>", RegexOptions.IgnoreCase); + internal Regex Signature { get; } = new(@"<\?xml\b[^>]*\bversion\s*=\s*(['""])[^'""]*\1[^\?>]*\?>", RegexOptions.IgnoreCase); public string Name => "XML";