Gernott / mask

TYPO3 Extension Mask
https://www.facebook.com/typo3mask
GNU General Public License v2.0
130 stars 86 forks source link

Allowed file extension overrides of multiple content elements influence each other #635

Open cweiske opened 4 months ago

cweiske commented 4 months ago

Problem

One of my content elements uses a Media field and stores its data in the default tt_content.assets column.

Despite having an empty allowedFileExtensions configuration, it only allows to select files with the following extensions: jpg jpeg png svg webp youtube vimeo.

It should default to common-media-types, though (see #481)

Cause

I have multiple content elements that use the assets field for storage. When adding debug statements to TcaCodeGenerator::getFileTCAConfig() and testing them with ./vendor/bin/typo3 cache:flush, it seems to me as if the allowed file extension settings of one field are used as base for the next field.

Example:

  1. Element "gallery" is the first using the assets column as media field. allowedFileExtensions is initially empty and gets "common-media-types" set by mask because the allowedFileExtensions config is empty.
  2. Element "teaser" is the next with the assets column as media field. allowedFileExtensions is initially set to "gif,jpg,jpeg,bmp,png,pdf,svg,ai,mp3,wav,mp4,ogg,flac,opus,webm,youtube,vimeo", which gets reduced to "jpg,jpeg,png,svg,webp" by mask because the content element definition has this configuration for allowedFileExtensions.
  3. Element "media" is the next with the assets column as media field. allowedFileExtensions is initially set to "jpg,jpeg,png,svg,webp", which is how the previous "teaser" element left it. It misses the video extensions.

The previous content element influences the allowed extensions in the next one.

Version

TYPO3 v12.4.16 with Mask v8.3.10. Also happens with mask v8.3.11, the lastest one.

nhovratov commented 4 months ago

Do you have the feature overrideSharedFields enabled?

cweiske commented 4 months ago

Yes, overrideSharedFields is enabled.

A workaround for this bug is to configure each media element to have allowedFileExtensions: common-media-types.