Problem/Motivation

When uploading a file not included in the default file extension list (jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp) of core's _file_save_upload_single method, validation will fail, and claim that the file type cannot be uploaded.

Screenshot of the user error

Steps to reproduce

Try to upload fe. an .rtf file with a combined upload form using the document media type.

Proposed resolution

Workaround core's file extensions check, which get's tricked by our combined upload validation callback.

Comments

ytsurk created an issue. See original summary.

ytsurk’s picture

Status: Active » Needs review
StatusFileSize
new850 bytes

This patch ensures a file_validate_extensions upload_validator, which is expected by core and makes all our desired extensions pass again.

ytsurk’s picture

Issue summary: View changes
StatusFileSize
new40.78 KB
ytsurk’s picture

Title: Combined upload is limited to the "default list" » Combined upload is limited to extensions of the "default list"
rang501’s picture

This patch seems to fix it.

rang501’s picture

Status: Needs review » Reviewed & tested by the community

  • ytsurk committed 181ceec on 2.x
    Issue #3183700 by ytsurk, rang501: Combined upload is limited to...
ytsurk’s picture

Status: Reviewed & tested by the community » Fixed

Thx for reporting and review :D

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

xrayfish’s picture

This still seems to be an issue. However, removing
'media_directories_ui_file_validator' => [$validators_by_media_type],
from

'media_directories_ui_file_validator' => [$validators_by_media_type],
// We need to respect core's _file_save_upload_single, by giving all extensions again.
'file_validate_extensions' => [$this->mediaDirectoriesUiHelper->getValidExtensions($target_types)],

works.

ytsurk’s picture

Need to re-check, this may have changed in D9, and will do a new issue if so ;)