EmailProfiler.Common: Auswertung der neuen DB Spalte ALLOW_XML_RECEIPTS

This commit is contained in:
PitzM 2025-01-17 11:36:51 +01:00
parent 5fd352dd1a
commit acdbf643fb
2 changed files with 9 additions and 8 deletions

View File

@ -653,6 +653,7 @@ Public Class clsWorkEmail
Dim oPathOriginal As String = oRow.ItemEx("PATH_ORIGINAL", "") Dim oPathOriginal As String = oRow.ItemEx("PATH_ORIGINAL", "")
Dim oExtractMainPath As String = oRow.ItemEx("PATH_EMAIL_TEMP", "") Dim oExtractMainPath As String = oRow.ItemEx("PATH_EMAIL_TEMP", "")
Try Try
Dim oSplit As String() Dim oSplit As String()
Dim oStorage As String Dim oStorage As String
@ -692,8 +693,8 @@ Public Class clsWorkEmail
End Try End Try
If Copy2HDD(pCurrentMail, oRow("COPY_2_HDD"), oRow("PATH_ORIGINAL"), oRow("PATH_EMAIL_ERRORS"), True) = True Then If Copy2HDD(pCurrentMail, oRow("COPY_2_HDD"), oRow("PATH_ORIGINAL"), oRow("PATH_EMAIL_ERRORS"), True) = True Then
Dim oAllowXMLReceipts As Boolean = oRow("ALLOW_XML_RECEIPTS")
If ExtractAttachments(pCurrentMail, oExtractMainPath) = True Then If ExtractAttachments(pCurrentMail, oExtractMainPath, oAllowXMLReceipts) = True Then
Return True Return True
Else Else
_Logger.Warn("!##Returning false from EXTRACT_ATTACHMENTS!##") _Logger.Warn("!##Returning false from EXTRACT_ATTACHMENTS!##")
@ -917,7 +918,7 @@ Public Class clsWorkEmail
End Try End Try
End Function End Function
Private Function ExtractAttachments(pCurrentMail As MailContainer, pExtractPath As String) As Boolean Private Function ExtractAttachments(pCurrentMail As MailContainer, pExtractPath As String, pAllowXMLReceipts As Boolean) As Boolean
_Logger.Debug("In ExtractAttachments - pExtractPath = [{0}]", pExtractPath) _Logger.Debug("In ExtractAttachments - pExtractPath = [{0}]", pExtractPath)
CURRENT_ATTMT_COUNT = 0 CURRENT_ATTMT_COUNT = 0
@ -955,7 +956,7 @@ Public Class clsWorkEmail
} }
EmailAttachments.Add(oEmailAttachment) EmailAttachments.Add(oEmailAttachment)
If ValidateFileExtension(oEmailAttachment) = False Then If ValidateFileExtension(oEmailAttachment, pAllowXMLReceipts) = False Then
oEmailAttachment.ErrorCodeValue = ErrorCode.NormalFileAttachmentCorrupt oEmailAttachment.ErrorCodeValue = ErrorCode.NormalFileAttachmentCorrupt
Continue For Continue For
End If End If
@ -1045,7 +1046,7 @@ Public Class clsWorkEmail
oEmbeddedFile.FileStatus = pGDPicturePDF.GetStat() oEmbeddedFile.FileStatus = pGDPicturePDF.GetStat()
If oEmbeddedFile.FileStatus = GdPictureStatus.OK Then If oEmbeddedFile.FileStatus = GdPictureStatus.OK Then
If ValidateFileExtension(oEmbeddedFile) = False Then If ValidateFileExtension(oEmbeddedFile, False) = False Then
oEmbeddedFile.ErrorCodeValue = ErrorCode.EmbeddedFileAttachmentCorrupt oEmbeddedFile.ErrorCodeValue = ErrorCode.EmbeddedFileAttachmentCorrupt
Continue For Continue For
End If End If
@ -1133,14 +1134,14 @@ Public Class clsWorkEmail
End Try End Try
End Function End Function
Private Function ValidateFileExtension(pAttachmentData As EmailAttachment) As Boolean Private Function ValidateFileExtension(pAttachmentData As EmailAttachment, pAllowXMLReceipts As Boolean) As Boolean
_Logger.Debug("Validate extension of [{0}]", pAttachmentData.OrgFileName) _Logger.Debug("Validate extension of [{0}]", pAttachmentData.OrgFileName)
Dim lowerFilename = pAttachmentData.OrgFileName.ToLower Dim lowerFilename = pAttachmentData.OrgFileName.ToLower
Dim oIsValidExtension As Boolean = False Dim oIsValidExtension As Boolean = False
Dim oIsGraphicExtension = _GraphicExtensions.Any(Function(ext) lowerFilename.EndsWith(ext)) Dim oIsGraphicExtension = _GraphicExtensions.Any(Function(ext) lowerFilename.EndsWith(ext))
If pAttachmentData.AttachmentPosition = 1 Then If pAllowXMLReceipts = True AndAlso pAttachmentData.AttachmentPosition = 1 Then
oIsValidExtension = _ValidFirstExtensions.Any(Function(ext) lowerFilename.EndsWith(ext)) oIsValidExtension = _ValidFirstExtensions.Any(Function(ext) lowerFilename.EndsWith(ext))
Else Else
oIsValidExtension = _ValidExtensions.Any(Function(ext) lowerFilename.EndsWith(ext)) oIsValidExtension = _ValidExtensions.Any(Function(ext) lowerFilename.EndsWith(ext))

View File

@ -15,7 +15,7 @@ Public Class ExtractAttachmentsFromEMLFile
Public Sub CallWorkerProcess(pEMLFilename As String, pConfigData As ConfigData) Public Sub CallWorkerProcess(pEMLFilename As String, pConfigData As ConfigData)
Dim oProfileIdForPolling = 0 Dim oProfileIdForPolling = 1
Dim oWorker As New clsWorker(_LogConfig, Dim oWorker As New clsWorker(_LogConfig,
pConfigData.ConnectionString, pConfigData.ConnectionString,
"", "",