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

quicksketch’s picture

markus_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.

markus_petrux’s picture

I 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.

quicksketch’s picture

Status: Needs review » Fixed

Thanks, after reviewing the code it's pretty clear that this.value is going to exist since we use it right below that line. Committed.

Status: Fixed » Closed (fixed)

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