Page MenuHomePhabricator

Pattern parameter in detailHTML for format constraint is HTML-escaped twice
Closed, ResolvedPublic


For the Format constraint of the “title” property on Wikipedia, the API reports the following constraint:

    "id": "ccf43722-b366-4d72-9260-85b7f19dc3e8",
    "type": "Format",
    "detail": {
        "pattern": [
    "detailHTML": "pattern: [^<]*"

The pattern is already HTML-escaped in the detail.pattern, and then in the detailHTML it’s HTML-escaped again. It probably shouldn’t be escaped yet in the detail.pattern.

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

Not a bug on our end. The ConstraintsFromTemplates script imports the constraints from wikitext, where the < is of course HTML-escaped, and doesn’t unescape it. The already escaped < then ends up in the database, in our constraint, and finally is escaped again in the detailHTML.

Since we don’t yet check the Format constraint anyways, I’m strongly inclined to just ignore this bug for now. I think it’s likely that we’ll import constraints from property statements before we start checking the Format constraint, and in that case, we won’t need the ConstraintsFromTemplates script any more and the bug won’t affect us (as long as we don’t introduce the same bug in the statement import).

Change 360873 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Add support for importing format parameters

Lucas_Werkmeister_WMDE moved this task from Doing to Review on the Wikidata-Former-Sprint-Board board.

Done as part of adding support for format constraint statements, since we already know whether the constraint comes from a template or from a statement, and so it’s easy to HTML-escape in one case but not in the other.

Change 360873 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Add support for importing format parameters