From 250f3607f68e2ddf451241b8e546e0bba1afb47a Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Tue, 29 Jul 2025 13:07:26 +0800 Subject: [PATCH] fix(windows): fix #4251 ensure case-insensitive checks for app extensions * Updated `GetAppExtensions` and `ParseAppInfo` methods to perform case-insensitive checks for `.lnk` and `.exe` file extensions. * This change improves compatibility with file systems that are case-sensitive. --- wox.core/plugin/system/app/app.go | 2 +- wox.core/plugin/system/app/app_windows.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wox.core/plugin/system/app/app.go b/wox.core/plugin/system/app/app.go index f5bfa9ba..484b5e6d 100644 --- a/wox.core/plugin/system/app/app.go +++ b/wox.core/plugin/system/app/app.go @@ -434,7 +434,7 @@ func (a *ApplicationPlugin) getAppPaths(ctx context.Context, appDirectories []ap for _, entry := range appPath { isExtensionMatch := lo.ContainsBy(appExtensions, func(ext string) bool { - return strings.HasSuffix(entry.Name(), fmt.Sprintf(".%s", ext)) + return strings.HasSuffix(strings.ToLower(entry.Name()), fmt.Sprintf(".%s", ext)) }) if isExtensionMatch { appPaths = append(appPaths, path.Join(dir.Path, entry.Name())) diff --git a/wox.core/plugin/system/app/app_windows.go b/wox.core/plugin/system/app/app_windows.go index e0dcefcc..3814ace9 100644 --- a/wox.core/plugin/system/app/app_windows.go +++ b/wox.core/plugin/system/app/app_windows.go @@ -113,10 +113,11 @@ func (a *WindowsRetriever) GetAppExtensions(ctx context.Context) []string { } func (a *WindowsRetriever) ParseAppInfo(ctx context.Context, path string) (appInfo, error) { - if strings.HasSuffix(path, ".lnk") { + lowerPath := strings.ToLower(path) + if strings.HasSuffix(lowerPath, ".lnk") { return a.parseShortcut(ctx, path) } - if strings.HasSuffix(path, ".exe") { + if strings.HasSuffix(lowerPath, ".exe") { return a.parseExe(ctx, path) } @@ -132,7 +133,7 @@ func (a *WindowsRetriever) parseShortcut(ctx context.Context, appPath string) (a a.api.Log(ctx, plugin.LogLevelInfo, fmt.Sprintf("Resolved shortcut %s -> %s", appPath, targetPath)) - if targetPath == "" || !strings.HasSuffix(targetPath, ".exe") { + if targetPath == "" || !strings.HasSuffix(strings.ToLower(targetPath), ".exe") { return appInfo{}, errors.New("no target path found or not an exe file") }