File extension validation broken

Created on 19 October 2021, about 3 years ago
Updated 23 July 2023, over 1 year ago

Problem/Motivation

File extension validation complains about invalid extention even if the extension is on the file_validate_extensions list.

Steps to reproduce

Setup a file field, plupload type, define file_validate_extensions. Upload file of correct extension - does not work, errors with invalid extension.

What happens is that validatePlUploadFile creates a File object with FILE_STATUS_PERMANENT status, then calls upload validators. Drupal's file_validate_extensions checks the FileUri for permanent files, which is '/tmp/randomName', not the FileName which is the original file name (this one is checked only for temporary files). Setting the File object status to 0 instead of FILE_STATUS_PERMANENT seems to work - though not sure at all this is a correct fix.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇷🇴Romania danb1974

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024