From acdbf643fb8ff75d7038a045ffc5686c5626988d Mon Sep 17 00:00:00 2001 From: pitzm Date: Fri, 17 Jan 2025 11:36:51 +0100 Subject: [PATCH] EmailProfiler.Common: Auswertung der neuen DB Spalte ALLOW_XML_RECEIPTS --- App/EmailProfiler.Common/clsWorkEmail.vb | 15 ++++++++------- .../TestClasses/ExtractAttachmentsFromEMLFile.vb | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/App/EmailProfiler.Common/clsWorkEmail.vb b/App/EmailProfiler.Common/clsWorkEmail.vb index f5d264b..bec79b8 100644 --- a/App/EmailProfiler.Common/clsWorkEmail.vb +++ b/App/EmailProfiler.Common/clsWorkEmail.vb @@ -653,6 +653,7 @@ Public Class clsWorkEmail Dim oPathOriginal As String = oRow.ItemEx("PATH_ORIGINAL", "") Dim oExtractMainPath As String = oRow.ItemEx("PATH_EMAIL_TEMP", "") + Try Dim oSplit As String() Dim oStorage As String @@ -692,8 +693,8 @@ Public Class clsWorkEmail End Try If Copy2HDD(pCurrentMail, oRow("COPY_2_HDD"), oRow("PATH_ORIGINAL"), oRow("PATH_EMAIL_ERRORS"), True) = True Then - - If ExtractAttachments(pCurrentMail, oExtractMainPath) = True Then + Dim oAllowXMLReceipts As Boolean = oRow("ALLOW_XML_RECEIPTS") + If ExtractAttachments(pCurrentMail, oExtractMainPath, oAllowXMLReceipts) = True Then Return True Else _Logger.Warn("!##Returning false from EXTRACT_ATTACHMENTS!##") @@ -917,7 +918,7 @@ Public Class clsWorkEmail End Try 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) CURRENT_ATTMT_COUNT = 0 @@ -955,7 +956,7 @@ Public Class clsWorkEmail } EmailAttachments.Add(oEmailAttachment) - If ValidateFileExtension(oEmailAttachment) = False Then + If ValidateFileExtension(oEmailAttachment, pAllowXMLReceipts) = False Then oEmailAttachment.ErrorCodeValue = ErrorCode.NormalFileAttachmentCorrupt Continue For End If @@ -1045,7 +1046,7 @@ Public Class clsWorkEmail oEmbeddedFile.FileStatus = pGDPicturePDF.GetStat() If oEmbeddedFile.FileStatus = GdPictureStatus.OK Then - If ValidateFileExtension(oEmbeddedFile) = False Then + If ValidateFileExtension(oEmbeddedFile, False) = False Then oEmbeddedFile.ErrorCodeValue = ErrorCode.EmbeddedFileAttachmentCorrupt Continue For End If @@ -1133,14 +1134,14 @@ Public Class clsWorkEmail End Try 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) Dim lowerFilename = pAttachmentData.OrgFileName.ToLower Dim oIsValidExtension As Boolean = False 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)) Else oIsValidExtension = _ValidExtensions.Any(Function(ext) lowerFilename.EndsWith(ext)) diff --git a/App/wisag_check_Att/TestClasses/ExtractAttachmentsFromEMLFile.vb b/App/wisag_check_Att/TestClasses/ExtractAttachmentsFromEMLFile.vb index 3d2714b..202af66 100644 --- a/App/wisag_check_Att/TestClasses/ExtractAttachmentsFromEMLFile.vb +++ b/App/wisag_check_Att/TestClasses/ExtractAttachmentsFromEMLFile.vb @@ -15,7 +15,7 @@ Public Class ExtractAttachmentsFromEMLFile Public Sub CallWorkerProcess(pEMLFilename As String, pConfigData As ConfigData) - Dim oProfileIdForPolling = 0 + Dim oProfileIdForPolling = 1 Dim oWorker As New clsWorker(_LogConfig, pConfigData.ConnectionString, "",