Skip to content
Snippets Groups Projects
Commit bbeddbc5 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

Merge branch 'bugfix_fileAttachments' into 'master'

[BUGFIX] Fix broken file reference attachments

See merge request !19
parents 838899a8 da01d57b
No related branches found
No related tags found
1 merge request!19[BUGFIX] Fix broken file reference attachments
......@@ -66,10 +66,6 @@ class FormsFinisher extends AbstractFinisher {
return;
}
if ($formRuntime === NULL) {
return;
}
$markers = [];
$markerLabels = [];
......
......@@ -895,7 +895,21 @@ class MailTemplateService {
$mail->setReplyTo($this->replyToAddress);
foreach ($this->markers as $marker) {
if ($marker instanceof FileReference) {
$mail->addAttachment($marker);
// we need to create proper copies of the attachment so that the original file reference does not get
// moved over to the mail model and worst case, the original model loses the reference because of this
$originalResource = $marker->getOriginalResource();
if ($originalResource instanceof \TYPO3\CMS\Core\Resource\FileReference) {
$coreFileReferenceMailFile = $this->resourceFactory->createFileReferenceObject(
[
'uid_local' => $originalResource->getOriginalFile()->getUid(),
'table_local' => 'sys_file',
'uid' => uniqid('NEW_MAIL', TRUE)
]
);
$newFileReference = GeneralUtility::makeInstance(FileReference::class);
$newFileReference->setOriginalResource($coreFileReferenceMailFile);
$mail->addAttachment($newFileReference);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment