Page MenuHomePhabricator

Blacklist certain filename patterns
Closed, ResolvedPublic

Description

Author: dstoykov

Description:
Mediawiki should allow blacklisting certain filename patterns for new files being uploaded. Particularly, blocking the patterns used by certain camera/scanner models, such as (DSC_[0-9]{4}\.jpg), will prevent users from uploading images with camera-generated filenames and force them to rename the to-be-uploaded files to something more meaningful.


Version: unspecified
Severity: enhancement

Details

Reference
bz10735

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:47 PM
bzimport set Reference to bz10735.
bzimport added a subscriber: Unknown Object (MLST).

You can use Javascript checking of the form and return some kind of notice saying something like "Please choose more descriptive name" when user clicks on upload button.

Also good upload manual on MediaWiki:Uploadtext can have preventive effect.

Bug 709 (rename/move files) is related and once fixed, this one loses its sense.

dstoykov wrote:

(In reply to comment #2)

Bug 709 (rename/move files) is related and once fixed, this one loses its
sense.

Not quite so, I think. Giving users a notice and forcing them to rename the file will habituate them to do it right in the future. Having someone else fix it will encourage them to do it wrong again next time.

dstoykov wrote:

(In reply to comment #1)

You can use Javascript checking of the form and return some kind of notice
saying something like "Please choose more descriptive name" when user clicks on
upload button.

Doing it on the client-side does have some advantages, although I was under the impression that MediaWiki struggles to keep the amount of js used at minimum. It might also be impossible to make it compatible with different skins.

Also good upload manual on MediaWiki:Uploadtext can have preventive effect.

On en.wikipedia.org it already says "Please choose a descriptive name for the destination filename in order to prevent duplicate names (for instance, "Cat.jpg" would not be a good name)". Doesn't help much - ignorant users just don't read. The "free images only" warning is even bigger, still masses of obvious copyvios get uploaded all the time.

This was done with r25620 and r25637 with a configurable blacklist: [[MediaWiki:Filename-prefix-blacklist]].