Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
1. /node/add/article
2. Upload an image in the wysiwyg editor
3. Console error: Uncaught TypeError: Cannot read property 'length' of undefined in Drupal.file.Drupal.file.validateExtension
Because that template, or more specifically template_preprocess_file_managed_file(), adds an id based on #element['id'], which is also added to the actual input element.
Proposed resolution
Add a suffix to the id? Just remove it (what does it even do?)
Speaking of that, what's the point of this template? And why does it exist in an identical version in classy and file?
Comments
Comment #1
idebr CreditAttribution: idebr commentedI suppose this is related to #2346893: Duplicate AJAX wrapper around a file field
Comment #2
BerdirI don't think so, this is inside the ajax element and the fix there doesn't look related at all. This is already duplicated before an ajax request happens.
Comment #3
idebr CreditAttribution: idebr commented@Berdir My bad, I didn't have an installation ready to confirm. I think @Wim Leers reported this issue before in #2235977: JS Client-side file validation is broken (because ajaxPageState is broken?)
Comment #4
BerdirThanks yes, that is in fact the bug. I even talked about this with him but he didn't remember :)
Comment #5
Berdir