Page MenuHomePhabricator

Warn when illegal characters are removed from filename
Closed, ResolvedPublic

Description

When uploading files with a destination filename that contains slashes, only the part of the name after the slash is used. The other part of the name is removed when pressing upload file. There should be a warning about the changed name, like the warning when spaces are changed to underscores.


Version: 1.11.x
Severity: normal

Details

Reference
bz10631

Event Timeline

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

Fixed with r24241.

The warning was missed for all illegal characters.

Hmm, seems to me there's still a bit of a problem with how the 'destination filename' box is treated compared to the originally-reported upload filename.

Since the reported upload filename sometimes includes a path, calling wfBasename() to strip the path components is a fairly sane way to treat it, and we wouldn't want to give a warning about it at that level.

The destination name, though, will usually be one of:

  • The already-stripped filename provided by the inline JS

or

  • Whatever the user typed in manually to override it.

In the former case, there shouldn't be any /s or \s since it's already been stripped clinet-side. In the latter case, the user might have typed a / or \ deliberately.

For an example, I tried setting a destination filename to "Graphite-half-1680 (OS/X).png" and got told the filename was being stripped to "X).png".

Better behavior might be to take the given destination filename and just strip out any / and \ chars as we do for : and other illegals, giving in this case "Graphite-half-1680 (OS-X).png"