From 462600d1b35fc32e1696d588ecd88c5788ce66ec Mon Sep 17 00:00:00 2001 From: pitzm Date: Mon, 9 Nov 2026 14:01:33 +0100 Subject: [PATCH] =?UTF-8?q?Modules.Jobs:=20Dateien=20l=C3=B6schen,=20falls?= =?UTF-8?q?=20Pr=C3=BCfung=20fehlschl=C3=A4gt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb index 510e96ce..92396511 100644 --- a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -868,6 +868,7 @@ Public Class ImportZUGFeRDFiles _logger.Error("Could not save File to Disk!") Dim oReasonString = "Could not save file " + newAttachmentFilename + " to disk." AddRejectedState(pMessageId, oReasonString, "EMBEDDED FILE CONSISTENCY NOT OK", "Info GUI", pConnections.SQLServerTransaction) + nextAttachmentIndex += 1 Continue For End If @@ -875,6 +876,11 @@ Public Class ImportZUGFeRDFiles _logger.Error("Could not save File to Disk!") Dim oReasonString = "Validation of file " + newAttachmentFilename + " on disk was NOT succesfully." AddRejectedState(pMessageId, oReasonString, "EMBEDDED FILE CONSISTENCY NOT OK", "Info GUI", pConnections.SQLServerTransaction) + + ' Datei ist Murks und muss gelöscht werden, wenn möglich + DeleteFileFromDisk(embeddedFilePath) + + nextAttachmentIndex += 1 Continue For End If @@ -920,6 +926,20 @@ Public Class ImportZUGFeRDFiles End Try End Function + Private Function DeleteFileFromDisk(pEmbeddedFilePath As String) As Boolean + + Try + Dim oFile As FileInfo = New FileInfo(pEmbeddedFilePath) + If oFile IsNot Nothing Then + oFile.Delete() + End If + Return True + Catch ex As Exception + _logger.Warn("Coul not delete file {0}.", pEmbeddedFilePath) + Return False + End Try + End Function + Private Function GetEmbeddedFileExtension(pMimeTypeValue As String) As String If pMimeTypeValue.IsNullOrEmpty() Then