Improved pandoc aailability check

This commit is contained in:
Thorsten Sommer 2025-12-11 20:42:04 +01:00
parent 2c9b6f10dc
commit 4dd64656e5
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -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;