Project

General

Profile

Actions

Bug #96744

closed

Unsupported file typ xxx.dwg (image/vnd.dwg)

Added by Martin Weymayer about 2 years ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2022-02-04
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
pending-close
Complexity:
Is Regression:
Sprint Focus:

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

96744_test.png (121 KB) 96744_test.png Oliver Hader, 2022-02-05 11:51

Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #102535: Unsupported file typ xxx.dwg (image/vnd.dwg)New2023-11-27

Actions
Actions #1

Updated by Bastian Bringenberg about 2 years ago

  • Project changed from 9 to TYPO3 Core
  • TYPO3 Version set to 11

Moved to right project.
Guessed TYPO3 Version.

Actions #2

Updated by Oliver Hader about 2 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":

https://github.com/TYPO3/typo3/blob/c02699a50f1ad7d4042c951f28eef28f43eb3577/typo3/sysext/core/Classes/Resource/AbstractFile.php#L308-L310

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.

https://github.com/TYPO3/typo3/blob/d3f6c5f039fa7b4ad6544104bdc73db2b6d74db1/typo3/sysext/core/Classes/Resource/Processing/LocalPreviewHelper.php#L130

Actions #3

Updated by Martin Weymayer about 2 years ago

It would be fine to add custom file extensions to a list in installtool like [GFX][imagefile_ext]

Actions #4

Updated by Oliver Hader about 2 years ago

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)

Actions #5

Updated by Martin Weymayer about 2 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

Actions #6

Updated by Oliver Hader about 2 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...

Actions #7

Updated by Martin Weymayer about 2 years ago

11.5.5 - same problem in version 9.5x

Actions #8

Updated by Oliver Hader about 2 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...

Actions #9

Updated by Oliver Hader about 2 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!

Actions #10

Updated by Oliver Hader about 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!

Actions #11

Updated by Jan Kornblum 5 months ago ยท Edited

In 9 LTS, none of olivers suggestions did work. I will open a new issue: https://forge.typo3.org/issues/102535

Actions #12

Updated by Jan Kornblum 5 months ago

  • Related to Bug #102535: Unsupported file typ xxx.dwg (image/vnd.dwg) added
Actions

Also available in: Atom PDF