Project

General

Profile

Bug #88022

Updated by Jarvis H over 5 years ago

h2. Description: 

 FileSize validation message shows with placeholders untouched, like so: 
 @You must select a file that is larger than %s in size.@ 


 h2. How to reproduce: 

 - Create a form with a file input field and add the FileSize validator to it. 
 - Submit form with file which does not pass file size validation. 

 h2. Potential cause: 

 Validation rules for file uploads are handled differently than with other fields as they are called in @typo3/sysext/form/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php@ in the method @importUploadedResource@ to prevent file uploads which do not pass validation. 

 If a validation fails, the method throws a @TypeConverterException@ which is caught and returned as a new error in this part of @importUploadedResource->convertFrom@: 

 <pre> 
 try { 
     $resource = $this->importUploadedResource($source, $configuration); 
 } catch (\Exception $e) { 
     return $this->objectManager->get(Error::class, $e->getMessage(), $e->getCode()); 
 } 
 </pre> 

 First thing I noticed is that the error instance is of the class @\TYPO3\CMS\Extbase\Error\Error@ and not @\TYPO3\CMS\Extbase\Validation\Error@ like the errors for all other fields. I do not know if this poses a problem. 

 Second, the error is instantiated using only the error message and code, which means all values which should be passed to the "arguments" property of the error instance are lost, hence the untouched "%s" parts of the error string. 
 




 web/typo3/sysext/form/Classes/Mvc/Property/PropertyMappingConfiguration.php

Back