diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaGroup.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaGroup.php index a1a9b858d9c4f2c268e03762b538f40e73ba57c9..5b60b59f55294aadfc8e386394e7e0ca1e2c54e5 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaGroup.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaGroup.php @@ -68,9 +68,9 @@ class TcaGroup implements FormDataProviderInterface if (empty($fieldConfig['config']['allowed'])) { $result['processedTca']['columns'][$fieldName]['config']['allowed'] = '*'; } - // Force uploadFolder for file_reference type + // Force empty uploadfolder for file_reference type if ($internalType === 'file_reference') { - $config['uploadfolder'] = ''; + $result['processedTca']['columns'][$fieldName]['config']['uploadfolder'] = ''; } // Simple list of files diff --git a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaGroupTest.php b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaGroupTest.php index 9b70b9b47fd15feabd489b42664c89e31ee19036..3a9c6e800f8640cf4b0c8c818dfbdd7cc421167f 100644 --- a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaGroupTest.php +++ b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaGroupTest.php @@ -94,6 +94,42 @@ class TcaGroupTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase $this->subject->addData($input); } + /** + * @test + */ + public function addDataSetsUploadFolderForFileReference() + { + $input = [ + 'databaseRow' => [ + 'aField' => '', + ], + 'processedTca' => [ + 'columns' => [ + 'aField' => [ + 'config' => [ + 'type' => 'group', + 'internal_type' => 'file_reference', + 'maxitems' => 99999, + ], + ], + ], + ], + ]; + + $expected = $input; + $expected['databaseRow']['aField'] = []; + $expected['processedTca']['columns']['aField']['config']['allowed'] = '*'; + $expected['processedTca']['columns']['aField']['config']['clipboardElements'] = []; + $expected['processedTca']['columns']['aField']['config']['uploadfolder'] = ''; + + $clipboardProphecy = $this->prophesize(Clipboard::class); + GeneralUtility::addInstance(Clipboard::class, $clipboardProphecy->reveal()); + $clipboardProphecy->initializeClipboard()->shouldBeCalled(); + $clipboardProphecy->elFromTable('_FILE')->shouldBeCalled()->willReturn([]); + + $this->assertEquals($expected, $this->subject->addData($input)); + } + /** * @test */ diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index 4892ad43d838f87e3950298e1b6f1f8d0b857c1c..1254355e748e230efc2b3121c8f914f570091bf1 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -2121,7 +2121,7 @@ class DataHandler if (!$this->bypassFileHandling) { // For logging.. $propArr = $this->getRecordProperties($table, $id); - // Get destrination path: + // Get destination path: $dest = PATH_site . $tcaFieldConf['uploadfolder']; // If we are updating: if ($status === 'update') {