Page MenuHomePhabricator

If a template parameter contains a | in a quoted string, parameter-handling method fail
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • First reported in a module removing the "residence" parameter from infobox officeholder, using RemoveTemplatePaameter.
  • Apply to a box with a residence parameter containing | in a quoted string

What happens?:
A mangled parameter is left behind. Reported in English Wikipedia [[Special:Diff/1348415854]].

What should have happened instead?:
The entire parameter is removed.

Other information (browser name/version, screenshots, etc.):
AWB 6.5.0.0 and earlier

This fix works in the reported case, but should be reviewed for possible other malignant cases: in Tools.PipeCleanedTemplate(), before the return add

if (restoftemplate.Contains("\""))
    restoftemplate = ReplaceWith(restoftemplate, QuotePair, RepWith);

where QuotePair is the regex "\".*?\"".

Event Timeline

Rjwilmsi claimed this task.
Rjwilmsi subscribed.

It's not about the quote character, it's about the ref name= containing pipes. It's common for the ref to contain a nested template with pipes in, we handle that. It's less common, but is valid for the ref name to contain pipes (has to be in quotes), need to handle that.

rev 13030 PipeCleanedTemplate: handle <ref> tags alongside other tags, as ref names or ref content can contain pipes