Bug #96744
closedUnsupported file typ xxx.dwg (image/vnd.dwg)
0%
Description
If you upload some "image" files to folder in fileadmin which are not listet in ImageMagickFile.php -> protected $allowedExtensions following error occures:
Unsupported file typ xxx.dwg (image/vnd.dwg)
This happens since introducing MimeTypeCollection.php where 'image/vnd.dwg' => ['dwg'], is added like other file types and TYPO3 ist now trying to send file through ImageMagick which can not handle the file type.
By manually (quick and dirty) adding protected $allowedExtensions = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'tif', 'tiff', 'bmp', 'pcx', 'tga', 'ico', 'dwg']; to line 87 in ImageMagickFile.php I could solve the problem - but next update all get lost.
Files
Updated by Bastian Bringenberg almost 3 years ago
- Project changed from 9 to TYPO3 Core
- TYPO3 Version set to 11
Moved to right project.
Guessed TYPO3 Version.
Updated by Oliver Hader almost 3 years ago
- Status changed from New to Needs Feedback
Which behavior would you expect?
a) just not showing the error message
b) rendering a proper preview of that dwg
file as well
It seems, that dwg
is not supported by ImageMagick (convert -list format
).
In case my observation is correct, adding the mime-type to ImageMagickFile
would just be a work-around, since that type cannot be processed by ImageMagic.
I'd suggest to avoid processing those files, in case they cannot be processed by ImageMagick at all. The file abstraction layer just considers any mime-type starting with image/
as image - however does not know about types that can be handled with ImageMagick - the (wrong) assumption is "ImageMagick can process all image formats":
So, either there could be an exclude list to deny image/vnd.dwg
(and other unsupported formats), or the capabilities and supported file formats of ImageMagick are auto-discovered by TYPO3.
A quick solution would be trigger preview rendering only, if the file extensions is configured accordingly in $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
. Thus, prefer using AbstractFile::isImage()
instead of AbstractFile::getType() === AbstractFile::FILETYPE_IMAGE
like currently in the example below.
Updated by Martin Weymayer almost 3 years ago
It would be fine to add custom file extensions to a list in installtool like [GFX][imagefile_ext]
Updated by Oliver Hader almost 3 years ago
- File 96744_test.png 96744_test.png added
I was not able to reproduce this in the fileadmin/
file-list module (see screenshot below).
Can you please describe how you produced this in your environment? Thanks in advance!
(the test DWG file has been taken from https://knowledge.autodesk.com/support/autocad/downloads/caas/downloads/content/autocad-sample-files.html)
Updated by Martin Weymayer almost 3 years ago
I uploades dgw file via ftp to folger "dwg-files" and then I clicked in backend on "filelist -> dwg-files"
maybe not all imagemagick versions support dwg files - but there are for shure other image-file-extensions which imagemagick can not handle and error will occure
Updated by Oliver Hader almost 3 years ago
What's the exact TYPO3 version that is being used here? I could not reproduce with TYPO3 v11.5.6-dev, but just realized that version assignment in this ticket was probably wrong...
Updated by Martin Weymayer almost 3 years ago
11.5.5 - same problem in version 9.5x
Updated by Oliver Hader almost 3 years ago
Thumbnails in the file-list view are rendered by this conditional branch:
https://github.com/TYPO3/typo3/blob/e8120972ffc3ef623f589dd5eaf1d5fee757b1f1/typo3/sysext/filelist/Classes/FileList.php#L692
Thus, either dwg
is configured in $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
https://github.com/TYPO3/typo3/blob/0b16a723296a63e726343673e74117f35bc3cb3c/typo3/sysext/core/Classes/Resource/AbstractFile.php#L333-L336
Or dwg
is configured in $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext']
https://github.com/TYPO3/typo3/blob/0b16a723296a63e726343673e74117f35bc3cb3c/typo3/sysext/core/Classes/Resource/AbstractFile.php#L342-L345
Removing dwg
from either imagefile_ext
or mediafile_ext
should solve the scenario you described. In case it does not, I'm lost and sorry since I have to give up guessing...
Updated by Oliver Hader almost 3 years ago
- Tags set to pending-close
I think the problem can be solved with the suggestions of my previous comment.
Thus, I'd like to close this ticket. Please report back, in case something should be changed code-wise. Thanks!
Updated by Oliver Hader over 2 years ago
- Status changed from Needs Feedback to Closed
Closing this ticket. Please reopen or create a new issue in case there are new aspects to this topic. Thanks in advance!
Updated by Jan Kornblum 12 months ago ยท Edited
In 9 LTS, none of olivers suggestions did work. I will open a new issue: https://forge.typo3.org/issues/102535
Updated by Jan Kornblum 12 months ago
- Related to Bug #102535: Unsupported file typ xxx.dwg (image/vnd.dwg) added