From 92cd4cc00816fdfca72080992a97c10700bb64ab Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 15 Aug 2024 13:21:30 +0200 Subject: [PATCH] Fix the `tmpHash` being set for files with an object id --- .../processor/AttachmentFileProcessor.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/system/file/processor/AttachmentFileProcessor.class.php b/wcfsetup/install/files/lib/system/file/processor/AttachmentFileProcessor.class.php index 9d0f62dbd7..6de38a51ae 100644 --- a/wcfsetup/install/files/lib/system/file/processor/AttachmentFileProcessor.class.php +++ b/wcfsetup/install/files/lib/system/file/processor/AttachmentFileProcessor.class.php @@ -51,10 +51,16 @@ final class AttachmentFileProcessor extends AbstractFileProcessor return; } + $objectID = $attachmentHandler->getObjectID(); + $tmpHash = $attachmentHandler->getTmpHashes()[0] ?? ''; + if ($objectID > 0) { + $tmpHash = ''; + } + AttachmentEditor::fastCreate([ 'objectTypeID' => $attachmentHandler->getObjectType()->objectTypeID, - 'objectID' => $attachmentHandler->getObjectID(), - 'tmpHash' => $attachmentHandler->getTmpHashes()[0] ?? '', + 'objectID' => $objectID, + 'tmpHash' => $tmpHash, 'fileID' => $file->fileID, 'userID' => WCF::getUser()->userID ?: null, 'uploadTime' => \TIME_NOW, @@ -298,6 +304,5 @@ final class AttachmentFileProcessorContext public readonly int $parentObjectID, public readonly string $tmpHash, - ) { - } + ) {} } -- 2.20.1