From e10733efe0728ef7829b69821f0040205546717c Mon Sep 17 00:00:00 2001 From: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> Date: Wed, 6 Dec 2023 23:35:42 +0100 Subject: [PATCH] [PT Run] Do not get target file icon for .lnk files (#30228) --- .../Image/WindowsThumbnailProvider.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/modules/launcher/Wox.Infrastructure/Image/WindowsThumbnailProvider.cs b/src/modules/launcher/Wox.Infrastructure/Image/WindowsThumbnailProvider.cs index af64306df5..47a765ed31 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/WindowsThumbnailProvider.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/WindowsThumbnailProvider.cs @@ -83,17 +83,10 @@ namespace Wox.Infrastructure.Image public static BitmapSource GetThumbnail(string fileName, int width, int height, ThumbnailOptions options) { IntPtr hBitmap = IntPtr.Zero; - string targetLinkedFilePath = string.Empty; + if (Path.GetExtension(fileName).Equals(".lnk", StringComparison.OrdinalIgnoreCase)) { - // If the file has a '.lnk' extension, it is a shortcut file. Use the shellLinkHelper to retrieve the actual target file path from the shortcut. - IShellLinkHelper shellLinkHelper = new ShellLinkHelper(); - targetLinkedFilePath = shellLinkHelper.RetrieveTargetPath(fileName); - } - - if (!string.IsNullOrEmpty(targetLinkedFilePath)) - { - hBitmap = ExtractIconToHBitmap(targetLinkedFilePath); + hBitmap = ExtractIconToHBitmap(fileName); } else {