Ensure Pandoc availability check before processing files

This commit is contained in:
Thorsten Sommer 2025-12-09 21:44:46 +01:00
parent 8b0f5dfbf8
commit 34dd75bb40
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -155,6 +155,12 @@ public sealed class ContentText : IContent
sb.AppendLine(this.Text); sb.AppendLine(this.Text);
if(this.FileAttachments.Count > 0) if(this.FileAttachments.Count > 0)
{
// Check Pandoc availability once before processing file attachments
var pandocState = await Pandoc.CheckAvailabilityAsync(Program.RUST_SERVICE, showMessages: true, showSuccessMessage: false);
if (!pandocState.IsAvailable || !pandocState.CheckWasSuccessful)
LOGGER.LogWarning("File attachments could not be processed because Pandoc is not available or the version check failed.");
else
{ {
sb.AppendLine(); sb.AppendLine();
sb.AppendLine("The following files are attached to this message:"); sb.AppendLine("The following files are attached to this message:");
@ -169,6 +175,7 @@ public sealed class ContentText : IContent
sb.AppendLine("````"); sb.AppendLine("````");
} }
} }
}
return sb.ToString(); return sb.ToString();
} }