EmailProfiler.Common: Liste der Anhänge einschränken, so dass nur erlaubte Dateitypen enthalten sind.
This commit is contained in:
parent
a73b8f5a16
commit
b68f94f35f
@ -944,7 +944,9 @@ Public Class clsWorkEmail
|
|||||||
Dim oAttachmentCount As Integer = 0 ' Anzahl gültige Anhänge
|
Dim oAttachmentCount As Integer = 0 ' Anzahl gültige Anhänge
|
||||||
Dim AttachmentPosition As Integer = 0 ' Position des Anhangs in der EMail
|
Dim AttachmentPosition As Integer = 0 ' Position des Anhangs in der EMail
|
||||||
|
|
||||||
For Each oAttachment As MimeData In pCurrentMail.Mail.Attachments
|
Dim oAttachmentList As List(Of MimeData) = GetPurgedAttachmentList(pCurrentMail.Mail.Attachments, pAllowXMLReceipts)
|
||||||
|
|
||||||
|
For Each oAttachment As MimeData In oAttachmentList
|
||||||
_Logger.Info("Working on Attachment [{0}]", oAttachment.SafeFileName)
|
_Logger.Info("Working on Attachment [{0}]", oAttachment.SafeFileName)
|
||||||
|
|
||||||
AttachmentPosition += 1
|
AttachmentPosition += 1
|
||||||
@ -1027,6 +1029,46 @@ Public Class clsWorkEmail
|
|||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Holt aus alle Anhängen diejenigen raus,
|
||||||
|
''' die einen erlaubten Dateianhang haben
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="pAttachmentList"></param>
|
||||||
|
''' <param name="pAllowXMLReceipts"></param>
|
||||||
|
''' <returns>Liste der Dateien, die wir verarbeiten wollen, nothing im Fehlerfall</returns>
|
||||||
|
Private Function GetPurgedAttachmentList(pAttachmentList As IMimeDataReadOnlyCollection, pAllowXMLReceipts As Boolean) As List(Of MimeData)
|
||||||
|
|
||||||
|
_Logger.Debug("GetPurgedAttachmentList()")
|
||||||
|
Try
|
||||||
|
|
||||||
|
Dim retValue As List(Of MimeData) = New List(Of MimeData)
|
||||||
|
Dim oIsValidExtension As Boolean = False
|
||||||
|
|
||||||
|
For Each oAttachment As MimeData In pAttachmentList
|
||||||
|
Dim lowerFilename = oAttachment.SafeFileName.ToLower
|
||||||
|
|
||||||
|
If pAllowXMLReceipts = True Then
|
||||||
|
oIsValidExtension = _ValidFirstExtensions.Any(Function(ext) lowerFilename.EndsWith(ext))
|
||||||
|
Else
|
||||||
|
oIsValidExtension = _ValidExtensions.Any(Function(ext) lowerFilename.EndsWith(ext))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If oIsValidExtension = True Then
|
||||||
|
retValue.Add(oAttachment)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
_Logger.Debug("GetPurgedAttachmentList() retValue contains [{0}] attachments.", retValue.Count)
|
||||||
|
|
||||||
|
Return retValue
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
_Logger.Error(ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Nothing
|
||||||
|
End Function
|
||||||
|
|
||||||
Private Sub WorkEmbeddedAttachments(pEmailAttachment As EmailAttachment, pGDPicturePDF As GdPicturePDF)
|
Private Sub WorkEmbeddedAttachments(pEmailAttachment As EmailAttachment, pGDPicturePDF As GdPicturePDF)
|
||||||
|
|
||||||
Dim embeddedFileCount As Integer = pGDPicturePDF.GetEmbeddedFileCount()
|
Dim embeddedFileCount As Integer = pGDPicturePDF.GetEmbeddedFileCount()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user