mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-10-20 18:43:58 +00:00
Improve file extension checks in CanHandle methods
This commit is contained in:
@@ -108,7 +108,7 @@ public class Plugin : IViewer
|
|||||||
|
|
||||||
// Disabled due mishandling text file types e.g., "*.config".
|
// Disabled due mishandling text file types e.g., "*.config".
|
||||||
// Only check extension for well known image and animated image types.
|
// Only check extension for well known image and animated image types.
|
||||||
return !Directory.Exists(path) && WellKnownExtensions.Contains(Path.GetExtension(path).ToLower());
|
return !Directory.Exists(path) && WellKnownExtensions.Any(ext => path.EndsWith(ext, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Prepare(string path, ContextObject context)
|
public void Prepare(string path, ContextObject context)
|
||||||
|
@@ -20,6 +20,7 @@ using QuickLook.Plugin.ImageViewer;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
@@ -49,7 +50,7 @@ public class Plugin : IViewer
|
|||||||
|
|
||||||
public bool CanHandle(string path)
|
public bool CanHandle(string path)
|
||||||
{
|
{
|
||||||
return !Directory.Exists(path) && WellKnownExtensions.Contains(Path.GetExtension(path.ToLower()));
|
return !Directory.Exists(path) && WellKnownExtensions.Any(ext => path.EndsWith(ext, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Prepare(string path, ContextObject context)
|
public void Prepare(string path, ContextObject context)
|
||||||
|
Reference in New Issue
Block a user