neos / neos-development-collection

The unified repository containing the Neos core packages, used for Neos development.
https://www.neos.io/
GNU General Public License v3.0
260 stars 221 forks source link

Files with mime type image/vnd.dxf crash Neos as it tries to process them with Neos\Media\Domain\Model\Image #3408

Open snoblucha opened 3 years ago

snoblucha commented 3 years ago

https://github.com/neos/flow-development-collection/blob/c00e0daf1d1df64fa073d67b25753a504f1b9a95/Neos.Utility.MediaTypes/Classes/MediaTypes.php#L228

When uploading a DXF file this mime type causes it to fail. It tries to read dimensions of this file (see below). When changed to application/dxf it works well.

Exception #1297759968 in line 215 of /data/www/Data/Temporary/Production/Cache/Code/Flow_Object_Classes/Neos_Flow_Mvc_Controller_Argument.php: Could not convert target type "Neos\Media\Domai
n\Model\Asset": Tried to refresh the dimensions and meta data of Image asset "" but the file of resource "d489466494b7fb9f69a4d04cab01e688d80cd09a" does not exist or is not a valid image.

44 Neos\Flow\Property\PropertyMapper_Original::convert(array|6|, "Neos\Media\Domain\Model\Asset", Neos\Flow\Mvc\Controller\MvcPropertyMappingConfiguration)
43 Neos\Flow\Mvc\Controller\Argument_Original::setValue(array|6|)
42 Neos\Flow\Mvc\Controller\AbstractController_Original::mapRequestArgumentsToControllerArguments()
41 Neos\Flow\Mvc\Controller\ActionController_Original::processRequest(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
40 Neos\Flow\Mvc\Dispatcher_Original::initiateDispatchLoop(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
39 Neos\Flow\Mvc\Dispatcher_Original::dispatch(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
38 Neos\Neos\Controller\Backend\ModuleController_Original::indexAction(array|3|)
37 Neos\Neos\Controller\Backend\ModuleController::indexAction(array|3|)
36 Neos\Neos\Controller\Backend\ModuleController::Flow_Aop_Proxy_invokeJoinPoint(Neos\Flow\Aop\JoinPoint)
35 Neos\Flow\Aop\Advice\AdviceChain::proceed(Neos\Flow\Aop\JoinPoint)
34 Neos\Flow\Security\Aspect\PolicyEnforcementAspect_Original::enforcePolicy(Neos\Flow\Aop\JoinPoint)
33 Neos\Flow\Aop\Advice\AroundAdvice::invoke(Neos\Flow\Aop\JoinPoint)
32 Neos\Flow\Aop\Advice\AdviceChain::proceed(Neos\Flow\Aop\JoinPoint)
31 Neos\Neos\Controller\Backend\ModuleController::indexAction(array|3|)
30 Neos\Flow\Mvc\Controller\ActionController_Original::callActionMethod()
29 Neos\Flow\Mvc\Controller\ActionController_Original::processRequest(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
28 Neos\Flow\Mvc\Dispatcher_Original::initiateDispatchLoop(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
27 Neos\Flow\Mvc\Dispatcher_Original::dispatch(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
26 Neos\Flow\Mvc\DispatchMiddleware_Original::process(GuzzleHttp\Psr7\ServerRequest, Neos\Flow\Http\Middleware\MiddlewaresChain)
25 Neos\Flow\Http\Middleware\MiddlewaresChain_Original::handle(GuzzleHttp\Psr7\ServerRequest)

...

Previous exception: Exception #1381141468 in line 68 of /data/www/Data/Temporary/Production/Cache/Code/Flow_Object_Classes/Neos_Media_Domain_Model_Image.php: Tried to refresh the dimensions
and meta data of Image asset "" but the file of resource "d489466494b7fb9f69a4d04cab01e688d80cd09a" does not exist or is not a valid image.

56 Neos\Media\Domain\Model\Image_Original::calculateDimensionsFromResource(Neos\Flow\ResourceManagement\PersistentResource)
55 Neos\Media\Domain\Model\Image_Original::initializeObject(1)
54 Neos\Media\Domain\Model\Image::__construct(Neos\Flow\ResourceManagement\PersistentResource)
53 Neos\Media\Domain\Model\Image::Flow_Aop_Proxy_invokeJoinPoint(Neos\Flow\Aop\JoinPoint)
52 Neos\Media\Domain\Model\Image::__construct(Neos\Flow\ResourceManagement\PersistentResource)
51 ReflectionClass::newInstanceArgs(array|1|)
50 Neos\Flow\Property\TypeConverter\ObjectConverter_Original::buildObject(array|5|, "Neos\Media\Domain\Model\Image")
kdambekalns commented 3 years ago

According to https://www.iana.org/assignments/media-types/media-types.xhtml the type image/vnd.dxf is correct. The issue needs to be fixed with the processing in neos/media.