Page MenuHomePhabricator

Upload form should prevent submission of filename with disallowed extension
Closed, ResolvedPublic


Since the upload form already knows the acceptable and blacklisted file extensions, and what strictness criteria are in force, it would be nice if we could have the form JS check whether your extension is ok before you actually upload the file and have it rejected.

Version: unspecified
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:25 PM
bzimport set Reference to bz16414.

Could also be implemented server side when "$wgAjaxUploadDestCheck = true;", I guess.

Another nice little one for the usability team to cut their teeth on. :)

(Note there are bigger changes to upload coming in a branch; CC'ing Michael Dale for reference.)

mdale wrote:

I believe the _extended_ commons upload js already checks for that sort of thing. See: setFileExtensions() & checkFileExtension() in

But it would be much cleaner to pull those values from the server. Perhaps in conjunction with the destination file check ajax request. (if $wgAjaxUploadDestCheck is true as Siebrand as points out)

*nod* We're already putting the whitelisted extensions into UI, so it should be straightforward to put out the whitelisted & blacklisted extensions to JS. :)

mdale wrote:

patch for skin.php and upload.js

... it does not appear that we where putting the whitelisted extensions into the UI after all... (added to skin.php for upload pages)

Addds the js for the extension check to the fillDestFilename function. This patch has also been committed to the upload branch in r49470

Life will be easier once jQuery is supported by default.. such a pain to write javascript without that library :( I think the next patch will be the script loader and it will add in jQuery by default.


mdale wrote:

the fix to this bug has been re-factored into uploadPage.js as part of the js2 code refactoring. It integrates better with the firefogg support and has been committed to the new-upload branch

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

Bryan.TongMinh wrote:

Was fixed somewhere along the way.