CKEditor file upload sets file URI prior to validation, causing validators to be unable to find the file.

Created on 5 July 2023, over 1 year ago
Updated 16 August 2024, 5 months ago

Problem/Motivation

While debugging a problem with the ClamAV module, I discovered that it was caused by the file validator hook attempting to find an uploaded file in its final destination while it was still a temporary upload. As an antivirus that module *should* be checking the file while it is in temp storage, and needs access to the exact file location to do so. $file->getFileUri() was returning a URI with the public:// scheme.

@larowlan pointed out on Slack that this was happening because \Drupal\ckeditor5\Controller\CKEditor5ImageController::upload sets the file uri before triggering validation.

Setting to Major as this "blocks a contributed module with no workaround".

Steps to reproduce

Add CkEditor5 and clamav module
Allow image upload in CkEditor5
Configure clamav
Upload an image via CkEditor5

Clamav errors because the file it is passed has a file path that does not exist yet

Proposed resolution

Not sure yet.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

🐛 Bug report
Status

Closed: outdated

Version

11.0 🔥

Component
CKEditor 5 

Last updated about 9 hours ago

Created by

🇦🇺Australia darvanen Sydney, Australia

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024