From 4dd64656e59acbc98356c2b0c35fbb604f872a19 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Thu, 11 Dec 2025 20:42:04 +0100 Subject: [PATCH] Improved pandoc aailability check --- .../Components/AttachDocuments.razor.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs index 511adfe5..5d650a43 100644 --- a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs +++ b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs @@ -76,10 +76,19 @@ public partial class AttachDocuments : MSGComponentBase } // Ensure that Pandoc is installed and ready: - await this.PandocAvailabilityService.EnsureAvailabilityAsync( + var pandocState = await this.PandocAvailabilityService.EnsureAvailabilityAsync( showSuccessMessage: false, showDialog: true); + // If Pandoc is not available (user cancelled installation), abort file drop: + if (!pandocState.IsAvailable) + { + this.Logger.LogInformation("The user cancelled the Pandoc installation or Pandoc is not available. Aborting file drop."); + this.ClearDragClass(); + this.StateHasChanged(); + return; + } + foreach (var path in paths) { if(!await this.IsFileExtensionValid(path)) @@ -106,10 +115,17 @@ public partial class AttachDocuments : MSGComponentBase private async Task AddFilesManually() { // Ensure that Pandoc is installed and ready: - await this.PandocAvailabilityService.EnsureAvailabilityAsync( + var pandocState = await this.PandocAvailabilityService.EnsureAvailabilityAsync( showSuccessMessage: false, showDialog: true); + // If Pandoc is not available (user cancelled installation), abort file selection: + if (!pandocState.IsAvailable) + { + this.Logger.LogInformation("The user cancelled the Pandoc installation or Pandoc is not available. Aborting file selection."); + return; + } + var selectedFile = await this.RustService.SelectFile(T("Select a file to attach")); if (selectedFile.UserCancelled) return;