From bd37e3f84d86f07df0840fc8f066ed9a4d198fbe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 16:38:27 +0000 Subject: [PATCH 1/3] Initial plan From 88efbee978e4ba3f82357101f69a19db456f307d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 16:43:46 +0000 Subject: [PATCH 2/3] Fix relative path handling in command line arguments Co-authored-by: emako <24737061+emako@users.noreply.github.com> --- QuickLook/App.xaml.cs | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/QuickLook/App.xaml.cs b/QuickLook/App.xaml.cs index 890243402..75570cd1c 100644 --- a/QuickLook/App.xaml.cs +++ b/QuickLook/App.xaml.cs @@ -126,8 +126,19 @@ protected override void OnStartup(StartupEventArgs e) RunListener(e); // First instance: run and preview this file - if (e.Args.Any() && (Directory.Exists(e.Args.First()) || File.Exists(e.Args.First()))) - PipeServerManager.SendMessage(PipeMessages.Toggle, e.Args.First()); + if (e.Args.Any()) + { + try + { + var path = Path.GetFullPath(e.Args.First()); + if (Directory.Exists(path) || File.Exists(path)) + PipeServerManager.SendMessage(PipeMessages.Toggle, path); + } + catch + { + // Invalid path, ignore + } + } // Exception handling events which are not caught in the Task thread TaskScheduler.UnobservedTaskException += (_, e) => @@ -290,16 +301,26 @@ private bool EnsureFirstInstance(string[] args) return true; // Second instance: preview this file - if (args.Any() && (Directory.Exists(args.First()) || File.Exists(args.First()))) + if (args.Any()) { - PipeServerManager.SendMessage(PipeMessages.Toggle, args.First(), [.. args.Skip(1)]); + try + { + var path = Path.GetFullPath(args.First()); + if (Directory.Exists(path) || File.Exists(path)) + { + PipeServerManager.SendMessage(PipeMessages.Toggle, path, [.. args.Skip(1)]); + return false; + } + } + catch + { + // Invalid path, continue to show duplicate message + } } + // Second instance: duplicate - else - { - MessageBox.Show(TranslationHelper.Get("APP_SECOND_TEXT"), TranslationHelper.Get("APP_SECOND"), - MessageBoxButton.OK, MessageBoxImage.Information); - } + MessageBox.Show(TranslationHelper.Get("APP_SECOND_TEXT"), TranslationHelper.Get("APP_SECOND"), + MessageBoxButton.OK, MessageBoxImage.Information); return false; } From b3ee2cf020d7fa07e4fd7bbc4cea2982e3fe675a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 16:46:21 +0000 Subject: [PATCH 3/3] Specify exception types in catch blocks for better error handling Co-authored-by: emako <24737061+emako@users.noreply.github.com> --- QuickLook/App.xaml.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/QuickLook/App.xaml.cs b/QuickLook/App.xaml.cs index 75570cd1c..42cf48b38 100644 --- a/QuickLook/App.xaml.cs +++ b/QuickLook/App.xaml.cs @@ -25,6 +25,7 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Security; using System.Threading; using System.Threading.Tasks; using System.Windows; @@ -134,7 +135,8 @@ protected override void OnStartup(StartupEventArgs e) if (Directory.Exists(path) || File.Exists(path)) PipeServerManager.SendMessage(PipeMessages.Toggle, path); } - catch + catch (Exception ex) when (ex is ArgumentException || ex is SecurityException || + ex is NotSupportedException || ex is PathTooLongException) { // Invalid path, ignore } @@ -312,7 +314,8 @@ private bool EnsureFirstInstance(string[] args) return false; } } - catch + catch (Exception ex) when (ex is ArgumentException || ex is SecurityException || + ex is NotSupportedException || ex is PathTooLongException) { // Invalid path, continue to show duplicate message }