Page MenuHomePhabricator

UploadWizard throws “Error: Unable to parse title“ when a URL parameter (categories) contains characters not allowed in page titles
Closed, ResolvedPublic

Description

Steps to reproduce:

Error: https://commons.wikimedia.org/w/load.php?debug=false&lang=fr&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=T5zOVd1J line 4 > eval at line 21: Error: Unable to parse title

Use case was Wiki Loves Monuments lists like fr:Liste des monuments historiques de Lyon who try to be smart and prefill stuff as much as possible.

Event Timeline

JeanFred raised the priority of this task from to Needs Triage.
JeanFred updated the task description. (Show Details)
JeanFred added a project: UploadWizard.
JeanFred subscribed.
Restricted Application added subscribers: Steinsplitter, Aklapper. · View Herald Transcript
JeanFred set Security to None.

Looks like the culprit (in this case at lease) is the '<' character.

Also occurs when trying to escape characters (using mw.uri.encode)

https://commons.wikimedia.org/wiki/Special:UploadWizard?categories=1%253Earrondissement

matmarex renamed this task from UploadWizard throws “Error: Unable to parse title“ when a URL parameter (categories) contains badly escaped characters to UploadWizard throws “Error: Unable to parse title“ when a URL parameter (categories) contains characters not allowed in page titles.Sep 14 2015, 4:31 PM
Jdforrester-WMF moved this task from Untriaged to Doing on the Multimedia board.

Change 238219 had a related patch set uploaded (by Bartosz Dziewoński):
Don't fail horribly when invalid categories are passed

https://gerrit.wikimedia.org/r/238219

Change 238219 merged by jenkins-bot:
Don't fail horribly when invalid categories are passed

https://gerrit.wikimedia.org/r/238219

matmarex subscribed.

Reopening until the fix is deployed on Commons.

By the way, the real issue here is that the parameter value is not valid. 1%3Csup%3Eer%3C%2Fsup%3E+arrondissement is "1<sup>er</sup> arrondissement", which is not a valid category name (or page title). You should fix whatever is generating the problematic URL. My fix makes UploadWizard just ignore the invalid value, rather than break entirely (like you said, the exception causes it to land in a state where you can't do anything).

Change 238421 had a related patch set uploaded (by Bartosz Dziewoński):
Don't fail horribly when invalid categories are passed

https://gerrit.wikimedia.org/r/238421

Change 238421 merged by jenkins-bot:
Don't fail horribly when invalid categories are passed

https://gerrit.wikimedia.org/r/238421