Jobs: escape attachment paths

This commit is contained in:
Jonathan Jenne 2022-11-02 13:34:33 +01:00
parent 882824d80f
commit b614b3f140

View File

@ -83,13 +83,14 @@ Public Class EmailFunctions
Dim oFinalBodyText = String.Format(EmailStrings.EMAIL_WRAPPING_TEXT.Replace(EmailStrings.constNAME_ZUGFERD_PORTAL, NamePortal), oCompleteBodyText)
Dim oEmailAddress = pEmailData.From
Dim oAttachment = pEmailData.Attachment
If oAttachment <> String.Empty Then
_logger.Debug($"Attachment_String [{oAttachment}]!")
If IO.File.Exists(oAttachment) = False Then
_logger.Info($"Attachment.File [{oAttachment}] is not existing!!!")
Dim oAttachmentPath = pEmailData.Attachment
If oAttachmentPath <> String.Empty Then
_logger.Debug($"Attachment_String [{oAttachmentPath}]!")
If IO.File.Exists(oAttachmentPath) = False Then
_logger.Info($"Attachment.File [{oAttachmentPath}] is not existing!!!")
End If
End If
Dim oAttachmentPathEscaped = oAttachmentPath.Replace("'", "''")
If IsNothing(oEmailAddress) OrElse String.IsNullOrWhiteSpace(oEmailAddress) Then
_logger.Warn("Could not find email-address for MessageId {0}", MessageId)
@ -133,7 +134,7 @@ Public Class EmailFunctions
,'{oFinalBodyText}'
,'{SourceProcedure}'
,'{oCreatedWho}'
,'{oAttachment}')"
,'{oAttachmentPathEscaped}')"
_mssql.ExecuteNonQuery(oInsert)
Else
'If oDTResult.Rows.Count = 0 Then