Page MenuHomePhabricator

API error response for list=user&usprops=cancreate with similar username has '$1' instead of real error code.
Open, Needs TriagePublic



Instead of an error code and error message, the response for a too-similar username says $1.

    "batchcomplete": "",
    "query": {
        "users": [
                "name": "Rages0ss",
                "missing": "",
                "cancreateerror": [
                        "message": "$1",
                        "params": [
                            "The username &quot;Rages0ss&quot; is too similar to the following username:<ul><li>Ragesoss</li></ul>Please choose another username."
                        "code": "$1",
                        "type": "error"

Acceptance criteria

  • The API response should deliver a proper error message and error code.

Event Timeline

Ragesoss created this task.Jun 6 2017, 5:42 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 6 2017, 5:42 PM
Anomie added a subscriber: Anomie.

Not an API error, that's what the underlying code is returning. In this case it seems to be coming from CentralAuth's AntiSpoof code, but AntiSpoof itself does the same thing.

A quick fix would be to use ApiRawMessage in those two places to set a code instead of allowing it to be derived from the message key. The message would still be "$1" though, because that's what the message in fact is. A more thorough fix would be to change the code to use a single message instead of pasting messages together like that.

TBolliger updated the task description. (Show Details)Sep 6 2017, 9:59 PM
TBolliger set the point value for this task to 2.Sep 26 2017, 6:17 PM
TBolliger removed the point value for this task.