Simetrical wrote:
However, we don't *really* have to use the same name in the filesystem as we use as a title. This seems to me like it would be better implemented by mangling the filename somehow. The invalid Windows/DOS characters are supposedly:
? [ ] / \ = + < > : ; " ,
[]=+;, are legal on windows.
Of those, I think the following are currently legal in image names (before your commit):
? \ = + : ; " ,
(Googled sources actually conflict as to the exact list of prohibited characters. Some say * is prohibited, some don't mention it.
It is for being a wildcard.
Same for |.
It is for being the pipe character.
^ is apparently supposed to be illegal in FAT, according to one source,
It is an escape character for windows shell, but legal in fat. Perhaps only legal in vfat?
and there are other restrictions, like no trailing space or period,
hmm, right. Although not really applicable for images which will have an extension appended.
and a list of reserved names like "com1" and "nul".
Strangely, not only are com1 and nul prohibited, but also nul.png or com1.jpg
Probably it varies across different versions, but it's a lot bigger than just ? and *, anyway.)
- Forbid files to be moved to invalid filenames
Instead of checking the filename against a list of bad characters, why not try to actually do it, and abort the rename if it can't be done? That way no special case will be missing, and it won't be that frequent anyway. YOu only need to avoid the slashes / \ (and : if wgUploadDir can be "")