Page MenuHomePhabricator

Special:UploadWizard gives undescriptive error message upon too long filename
Closed, DuplicatePublic

Description

When choosing a filename which is too long in UW the resulting error message is mwe-upwiz-unparseable-title which mentions nothing about file length.

A quick fix would be to add the file length restriction to that error message. A better solution would be to have a separate error (in UW and in the API) for too long titles compared to titles containing illegal characters.

It would also seem that UW allows for longer filenames than Special:Upload (i.e. before T87313 kicks in). Could possibly be due to length checking being with file extension in Special:Upload but without it in UW.

Event Timeline

Lokal_Profil raised the priority of this task from to Needs Triage.
Lokal_Profil updated the task description. (Show Details)
Lokal_Profil added a subscriber: Lokal_Profil.
Aklapper renamed this task from Special:UploadWizard gives undescriptive erro message upon too long filename to Special:UploadWizard gives undescriptive error message upon too long filename.Jan 24 2015, 1:54 AM
Aklapper set Security to None.

UW checks whether mw.Title.newFromText() is successful, and that function just returns false whether the title is too long or has invalid characters or whatever else, so I would say this has to be solved in core. (Not sure how though - maybe by mw.Title providing a validator that uses the same logic but returns error codes?)

Could possibly be due to length checking being with file extension in Special:Upload but without it in UW.

Or (UTF-16) characters vs. bytes? Haven't looked at the code, just guessing.

So maybe the logic would be:
Use newFromTitle() to check the title, if newFromTitle() returns false, use a validator function on the title to check what error it was? newFromTitle() could use the validator to check the title internally so we wouldn't have two copies of the "valid title" checks.

It doesn't look like this is still an issue. It's now calling mw.Title.newFromFileName to auto-sanitize it (plus some additional UW-specific sanitization).

See also T66912: UploadWizard: Accept files whose names are invalid MediaWiki titles

Re-open if this is still present.