From: Alexander Ebert Date: Thu, 15 Aug 2024 11:21:30 +0000 (+0200) Subject: Fix the `tmpHash` being set for files with an object id X-Git-Tag: 6.1.0_Alpha_2~13 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=92cd4cc00816fdfca72080992a97c10700bb64ab;p=GitHub%2FWoltLab%2FWCF.git Fix the `tmpHash` being set for files with an object id --- 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, - ) { - } + ) {} }