Page MenuHomePhabricator

Use alternative separator character when calling wbsetaliases
Closed, ResolvedPublic

Description

wbsetaliases accepts multiple values for the add, remove, and set parameters. These are passed as a pipe-separated list via the values parameter. This means that any client code, including the Wikibase UI code, needs to use the alternative separator character:

The API offers an alternative separator for multivalue parameters: If a string starts with ASCII code \x1F (Unit Separator), any other occurrence of \x1F in the string will be treated as a separator, and pipe characters are treated as literal. See ApiBase::explodeMultiValue() for reference.

Clients that want to allow pipe characters to be present in aliases need to prepend the parameter value with \x1F.

See also T64925: Use alternative separator character when calling wbparsevalue

Patch-For-Review:

Event Timeline

daniel renamed this task from wbparsevalue cannot process strings that contain a pipe "|" character to wbsetaliases cannot process strings that contain a pipe "|" character.Jun 13 2017, 10:34 AM
daniel triaged this task as Medium priority.
daniel updated the task description. (Show Details)
daniel renamed this task from wbsetaliases cannot process strings that contain a pipe "|" character to Use alternative separator character when calling wbsetaliases.Jun 20 2017, 8:19 AM
daniel updated the task description. (Show Details)

Change 360354 had a related patch set uploaded (by Thiemo Mättig (WMDE); owner: Thiemo Mättig (WMDE)):
[mediawiki/extensions/WikibaseJavaScriptApi@master] [WIP] Use alternative separator character in API requests

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

Change 360354 merged by jenkins-bot:
[mediawiki/extensions/WikibaseJavaScriptApi@master] Use alternative separator character in API requests

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

I was just trying to add an alias which contains pipe characters and instead of the text I entered, it split it into two separate aliases (see https://www.wikidata.org/w/index.php?diff=514571743 where it added "N" and "ng" instead of "N||ng"). Is that covered by this ticket, or should I create a new one?

Change 363786 had a related patch set uploaded (by Thiemo Mättig (WMDE); owner: Thiemo Mättig (WMDE)):
[mediawiki/extensions/Wikibase@master] Update JavaScript API dependency to 2.2.1

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

thiemowmde updated the task description. (Show Details)
thiemowmde moved this task from Proposed to Review on the Wikidata-Former-Sprint-Board board.
thiemowmde moved this task from incoming to in progress on the Wikidata board.

Thanks for the reminder, @Nikki! The issue is fixed in the code, but we did not released and deployed the component yet. I listed the remaining steps necessary in the task description and moved this ticket back to our current review board.

Change 363786 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Update JavaScript API dependency to 2.2.2

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

thiemowmde removed a project: Patch-For-Review.
thiemowmde updated the task description. (Show Details)