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.
Hi,
Using IE6 it is possible to enter a file name in the filefield widget and then clear the field, before pressing the upload button. This operation triggers the onchange event of the DOM element and the validation routine fires an error about the extension, when it is in fact empty.
This validation step should only take place if the filefield widget is not empty. I believe the following change in filefield.js would fix this:
- if (accept.length > 1) {
+ if (accept.length > 1 && this.value.length > 0) {
Comments
Comment #1
quicksketchmarkus_petrux, I'll give this a shot in other browsers. It'd be a shame to break other browsers to fix the silliness of IE6.
Comment #2
markus_petrux CreditAttribution: markus_petrux commentedI also checked with Firefox, and here it doesn't seem to be possible because firefox pops up the "Browse" dialog as soon the element gets the focus.
So checked with Opera, and it doesn't pop up as in Firefox, so the user is able to blank the filename in the element, and that will bring the same error as in IE6.
In summary, the problem may affect browsers that allow the user to modify the "file" element directly, which doesn't seem to be possible in Firefox.
Comment #3
quicksketchThanks, after reviewing the code it's pretty clear that
this.value
is going to exist since we use it right below that line. Committed.